Skip to content

Commit

Permalink
Add Native AOT smoke test (#82)
Browse files Browse the repository at this point in the history
* Add Native AOT smoke test

* Try again

* Sigh

* What else is there

* Update CLRTest.NativeAot.targets

* Not this way

* Build accelerator

* Do not require building CoreCLR CoreLib

* Do not run xunit with corerun

* Copy over JIT and JitInterface

* Fix up build script

* Ok let's see

* Maybe get linux support

* Revert "Maybe get linux support"

This reverts commit 44b8b4d.

* Revert "Build accelerator"

This reverts commit 6cec9ba.

* Add more tests

* Always build libs as Release

* Linux support

* Maybe fix linux

* Yaml bs

/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml (Line: 8, Col: 1): Unexpected value 'variables'

* Revert "Revert "Build accelerator""

This reverts commit a236229.

* Update ConfigurablePInvokePolicy.cs

* Sigh

* Revert "Revert "Revert "Build accelerator"""

This reverts commit ae0cd8d.

* Enable debug symbols

* Try to fix linux

* Do we need this?

* Revert "Do we need this?"

This reverts commit 582faad.

* Don't run tests on Linux

* CR feedback

* Fix conflict with master

* Fix building JIT without runtime on Linux

* Don't build createdump
* We need mscorrc

* Do mscorrc differently

* Add comment
  • Loading branch information
MichalStrehovsky committed Sep 11, 2020
2 parents 3ca0a94 + e7646b4 commit a458687
Show file tree
Hide file tree
Showing 26 changed files with 5,621 additions and 153 deletions.
5 changes: 5 additions & 0 deletions dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@ source $scriptroot/eng/common/tools.sh
InitializeDotNetCli true # Install
__dotnetDir=${_InitializeDotNetCli}

# Temporarily make this dotnet more permanent
# We need this for Native AOT CI testing until ilc becomes a selfcontained app.
export DOTNET_ROLL_FORWARD=Major
export DOTNET_ROOT=${__dotnetDir}

dotnetPath=${__dotnetDir}/dotnet
${dotnetPath} "$@"
89 changes: 2 additions & 87 deletions eng/pipelines/runtimelab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
jobParameters:
timeoutInMinutes: 90
testGroup: innerloop
buildArgs: -s clr+libs+installer -c debug -runtimeConfiguration Checked
buildArgs: -s nativeaot+libs+installer -lc release -rc checked
extraStepsTemplate: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml

#
Expand All @@ -81,7 +81,7 @@ jobs:
jobParameters:
timeoutInMinutes: 90
testGroup: innerloop
buildArgs: -s clr+libs+libs.tests+installer -c $(_BuildConfig) /p:ArchiveTests=true
buildArgs: -s nativeaot+libs+installer -c $(_BuildConfig) /p:ArchiveTests=true
extraStepsTemplate: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml
extraStepsParameters:
uploadTests: true
Expand All @@ -100,88 +100,3 @@ jobs:
nameSuffix: All_Configurations
buildArgs: -s clr.runtime+libs -c $(_BuildConfig) -allConfigurations

#
# CoreCLR Test builds using live libraries release build
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: Checked
platforms:
- CoreClrTestBuildHost # Either OSX_x64 or Linux_x64
jobParameters:
testGroup: innerloop
liveLibrariesBuildConfig: Release
dependsOn:
- build_Linux_x64_Checked_
- build_Linux_x64_Release_

#
# CoreCLR Test executions using live libraries
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: Checked
platforms:
- Linux_x64
helixQueueGroup: pr
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
jobParameters:
testGroup: innerloop
liveLibrariesBuildConfig: Release
dependsOn:
- coreclr_common_test_build_p0_AnyOS_AnyCPU_Checked

- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: Checked
platforms:
- Windows_NT_x64
helixQueueGroup: pr
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
jobParameters:
testGroup: innerloop
liveLibrariesBuildConfig: Release
dependsOn:
- coreclr_common_test_build_p0_AnyOS_AnyCPU_Checked
- build_Windows_NT_x64_Checked_
- build_Windows_NT_x64_Release_

#
# Libraries Release Test Execution against a release coreclr runtime
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/libraries/run-test-job.yml
buildConfig: Release
platforms:
- Linux_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isFullMatrix: false
isOfficialBuild: false
testScope: innerloop
liveRuntimeBuildConfig: Release
dependsOnTestBuildConfiguration: Release
dependsOnTestArchitecture: x64
dependsOn:
- build_Linux_x64_Release_

- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/libraries/run-test-job.yml
buildConfig: Release
platforms:
- Windows_NT_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isFullMatrix: false
isOfficialBuild: false
testScope: innerloop
liveRuntimeBuildConfig: Release
dependsOnTestBuildConfiguration: Release
dependsOnTestArchitecture: x64
dependsOn:
- build_Windows_NT_x64_Release_
57 changes: 8 additions & 49 deletions eng/pipelines/runtimelab/runtimelab-post-build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,12 @@ parameters:

steps:
# Build coreclr native test output
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) skipstressdependencies skipmanaged skipgeneratelayout $(buildConfigUpper) ${{ parameters.archType }}
displayName: Build native test components
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) skipstressdependencies $(buildConfigUpper) ${{ parameters.archType }}
displayName: Build tests

# Copy all build output into artifacts staging directory
- template: /eng/pipelines/libraries/prepare-for-bin-publish.yml

# Zip CoreCLR Build Output
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/artifacts/bin/coreclr/${{ parameters.osGroup }}.${{ parameters.archType }}.$(buildConfigUpper)
archiveType: $(archiveType)
tarCompression: $(tarCompression)
includeRootFolder: false
archiveExtension: $(archiveExtension)
artifactName: CoreCLRProduct__${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}
displayName: 'CoreCLR product build'

# Zip Test Build
- ${{ if eq(parameters.uploadTests, true) }}:
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/artifacts/helix
includeRootFolder: true
archiveType: $(archiveType)
archiveExtension: $(archiveExtension)
tarCompression: $(tarCompression)
artifactName: libraries_test_assets_${{ parameters.osGroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}
displayName: Test Assets

# Zip product native assets for use by Tests
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/artifacts/tests/coreclr/obj/${{ parameters.osGroup }}.${{ parameters.archType }}.$(buildConfigUpper)
includeRootFolder: false
archiveType: $(archiveType)
tarCompression: $(tarCompression)
archiveExtension: $(archiveExtension)
artifactName: CoreCLRNativeTestArtifacts_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}
displayName: 'native test components'

# Zip Libraries Build Output
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.ArtifactStagingDirectory)/artifacts
archiveType: $(archiveType)
tarCompression: $(tarCompression)
includeRootFolder: false
archiveExtension: $(archiveExtension)
artifactName: libraries_bin_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}
displayName: Build Assets
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
- script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }}
displayName: Run tests
#- ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
# - script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) --runnativeaottests $(buildConfigUpper) ${{ parameters.archType }}
# displayName: Run tests
15 changes: 12 additions & 3 deletions src/coreclr/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ endif(CLR_CMAKE_TARGET_WIN32 AND FEATURE_EVENT_TRACE)
add_subdirectory(debug/dbgutil)

if(CLR_CMAKE_HOST_UNIX)
if(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID))
add_subdirectory(debug/createdump)
endif(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID))
if(CLR_CMAKE_BUILD_SUBSET_RUNTIME)
if(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID))
add_subdirectory(debug/createdump)
endif(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID))
endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME)

# Include the dummy c++ include files
include_directories("pal/inc/rt/cpp")
Expand Down Expand Up @@ -84,5 +86,12 @@ if (CLR_CMAKE_BUILD_SUBSET_RUNTIME)
if(CLR_CMAKE_HOST_WIN32)
add_subdirectory(hosts)
endif(CLR_CMAKE_HOST_WIN32)
else()
if(CLR_CMAKE_HOST_UNIX)
# this is needed to compile the jit on unix platforms.
# When the runtime subset is compiled, the add_subdirectory(dlls) above
# brings the mscorrc library into the build graph
add_subdirectory(dlls/mscorrc)
endif(CLR_CMAKE_HOST_UNIX)
endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME)

Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ public override bool GenerateDirectCall(string importModule, string methodName)
methodName == "CreateEventExW" ||
methodName == "SetEvent" ||
methodName == "ResetEvent" ||
methodName == "GetProcessHeap" ||
methodName == "HeapAlloc" ||
methodName == "LoadLibraryExW" ||
methodName == "GetProcAddress" ||
methodName == "SetLastError" ||
methodName == "GetLastError" ||
methodName == "LocalAlloc")
methodName == "LocalAlloc" ||
methodName == "LocalFree")
{
return true;
}
Expand Down
27 changes: 22 additions & 5 deletions src/coreclr/src/tools/aot/ILCompiler/ILCompiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@
<Configurations>Debug;Release;Checked</Configurations>
</PropertyGroup>

<PropertyGroup>
<LibraryNamePrefix>lib</LibraryNamePrefix>
<LibraryNamePrefix Condition="$([MSBuild]::IsOsPlatform('WINDOWS'))"></LibraryNamePrefix>
<LibraryNameExtension Condition="$([MSBuild]::IsOsPlatform('WINDOWS'))">.dll</LibraryNameExtension>
<LibraryNameExtension Condition="$([MSBuild]::IsOsPlatform('LINUX'))">.so</LibraryNameExtension>
<LibraryNameExtension Condition="$([MSBuild]::IsOsPlatform('OSX'))">.dylib</LibraryNameExtension>
</PropertyGroup>

<PropertyGroup>
<ObjectWriterVersion>1.0.0-alpha-28820-01</ObjectWriterVersion>
<CoreDisToolsVersion>1.0.1-prerelease-00005</CoreDisToolsVersion>

<ObjWriterLibrary Condition="'$(TargetsWindows)' == 'true'">objwriter.dll</ObjWriterLibrary>
<ObjWriterLibrary Condition="'$(TargetsOSX)' == 'true'">libobjwriter.dylib</ObjWriterLibrary>
<ObjWriterLibrary Condition="'$(ObjWriterLibrary)' == ''">libobjwriter.so</ObjWriterLibrary>

<!-- CoreDisTools are used in debugging visualizers. The package only exists on Windows -->
<IncludeCoreDisTools Condition="'$(TargetsWindows)' == 'true' and '$(Configuration)' != 'Release'">true</IncludeCoreDisTools>
</PropertyGroup>
Expand All @@ -38,7 +42,7 @@
</ItemGroup>

<ItemGroup>
<Content Include="$(NuGetPackageRoot)\runtime.$(DefaultAppHostRuntimeIdentifier).microsoft.dotnet.objectwriter\$(ObjectWriterVersion)\runtimes\$(DefaultAppHostRuntimeIdentifier)\native\$(ObjWriterLibrary)">
<Content Include="$(NuGetPackageRoot)\runtime.$(DefaultAppHostRuntimeIdentifier).microsoft.dotnet.objectwriter\$(ObjectWriterVersion)\runtimes\$(DefaultAppHostRuntimeIdentifier)\native\$(LibraryNamePrefix)objwriter$(LibraryNameExtension)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
<Pack>false</Pack>
Expand All @@ -49,6 +53,19 @@
<Visible>false</Visible>
<Pack>false</Pack>
</Content>

<Content Include="$(BinDir)\$(LibraryNamePrefix)jitinterface_$(TargetArchitecture)$(LibraryNameExtension)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
<Pack>false</Pack>
</Content>

<Content Include="$(BinDir)\$(LibraryNamePrefix)clrjit$(LibraryNameExtension)">
<Link>$(LibraryNamePrefix)clrjitilc$(LibraryNameExtension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
<Pack>false</Pack>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/coreclr/tests/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
parser.add_argument("--ilasmroundtrip", dest="ilasmroundtrip", action="store_true", default=False)
parser.add_argument("--run_crossgen_tests", dest="run_crossgen_tests", action="store_true", default=False)
parser.add_argument("--run_crossgen2_tests", dest="run_crossgen2_tests", action="store_true", default=False)
parser.add_argument("--run_nativeaot_tests", dest="run_nativeaot_tests", action="store_true", default=False)
parser.add_argument("--large_version_bubble", dest="large_version_bubble", action="store_true", default=False)
parser.add_argument("--precompile_core_root", dest="precompile_core_root", action="store_true", default=False)
parser.add_argument("--skip_test_run", dest="skip_test_run", action="store_true", default=False, help="Does not run tests. Useful in conjunction with --precompile_core_root")
Expand Down Expand Up @@ -909,6 +910,11 @@ def run_tests(args,
print("Setting RunCrossGen2=true")
os.environ["RunCrossGen2"] = "true"

if args.run_nativeaot_tests:
print("Running tests Native AOT")
print("Setting RunNativeAot=true")
os.environ["RunNativeAot"] = "true"

if args.large_version_bubble:
print("Large Version Bubble enabled")
os.environ["LargeVersionBubble"] = "true"
Expand Down Expand Up @@ -1083,6 +1089,11 @@ def setup_args(args):
lambda unused: True,
"Error setting run_crossgen2_tests")

coreclr_setup_args.verify(args,
"run_nativeaot_tests",
lambda unused: True,
"Error setting run_nativeaot_tests")

coreclr_setup_args.verify(args,
"precompile_core_root",
lambda arg: True,
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/tests/src/CLRTest.Execute.Bash.targets
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ then
else
LAUNCHER="$_DebuggerFullPath $(_CLRTestRunFile)"
fi
if [ ! -z "$RunNativeAot" ]
then
LAUNCHER="$_DebuggerFullPath"
fi
$(BashIlrtTestLaunchCmds)
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/tests/src/CLRTest.Execute.Batch.targets
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ IF NOT "%CLRCustomTestLauncher%"=="" (
) ELSE (
set LAUNCHER=%_DebuggerFullPath% $(_CLRTestRunFile)
)
IF NOT "%RunNativeAot%"=="" (
set LAUNCHER=%_DebuggerFullPath%
)
$(BatchIlrtTestLaunchCmds)
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/tests/src/CLRTest.Execute.targets
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ This file contains the logic for providing Execution Script generation.

<Import Project="CLRTest.Jit.targets" />
<Import Project="CLRTest.CrossGen.targets" />
<Import Project="CLRTest.NativeAot.targets" />
<Import Project="CLRTest.GC.targets" />
<Import Project="CLRTest.Execute.*.targets" />
<Import Project="CLRTest.MockHosting.targets" Condition="'$(RequiresMockHostPolicy)' == 'true'" />
Expand Down
Loading

0 comments on commit a458687

Please sign in to comment.