diff --git a/dotnet.sh b/dotnet.sh index a612ebac1ce1..ca0d14e6f61e 100755 --- a/dotnet.sh +++ b/dotnet.sh @@ -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} "$@" diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 8e8149421ed8..35f3e0405624 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -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 # @@ -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 @@ -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_ diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index 009e04abc02f..20e1c0606678 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -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 diff --git a/src/coreclr/src/CMakeLists.txt b/src/coreclr/src/CMakeLists.txt index 0866be360fd0..1ee527d6604e 100644 --- a/src/coreclr/src/CMakeLists.txt +++ b/src/coreclr/src/CMakeLists.txt @@ -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") @@ -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) diff --git a/src/coreclr/src/tools/aot/ILCompiler/ConfigurablePInvokePolicy.cs b/src/coreclr/src/tools/aot/ILCompiler/ConfigurablePInvokePolicy.cs index e3edc1d60cf7..3f53d9a4902e 100644 --- a/src/coreclr/src/tools/aot/ILCompiler/ConfigurablePInvokePolicy.cs +++ b/src/coreclr/src/tools/aot/ILCompiler/ConfigurablePInvokePolicy.cs @@ -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; } diff --git a/src/coreclr/src/tools/aot/ILCompiler/ILCompiler.csproj b/src/coreclr/src/tools/aot/ILCompiler/ILCompiler.csproj index 3a1bb7db1185..f97b07f50633 100644 --- a/src/coreclr/src/tools/aot/ILCompiler/ILCompiler.csproj +++ b/src/coreclr/src/tools/aot/ILCompiler/ILCompiler.csproj @@ -16,14 +16,18 @@ Debug;Release;Checked + + lib + + .dll + .so + .dylib + + 1.0.0-alpha-28820-01 1.0.1-prerelease-00005 - objwriter.dll - libobjwriter.dylib - libobjwriter.so - true @@ -38,7 +42,7 @@ - + PreserveNewest false false @@ -49,6 +53,19 @@ false false + + + PreserveNewest + false + false + + + + $(LibraryNamePrefix)clrjitilc$(LibraryNameExtension) + PreserveNewest + false + false + diff --git a/src/coreclr/tests/runtest.py b/src/coreclr/tests/runtest.py index 410b0f518fc2..dae35ed39ae0 100755 --- a/src/coreclr/tests/runtest.py +++ b/src/coreclr/tests/runtest.py @@ -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") @@ -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" @@ -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, diff --git a/src/coreclr/tests/src/CLRTest.Execute.Bash.targets b/src/coreclr/tests/src/CLRTest.Execute.Bash.targets index fbb62424e167..538496eeb462 100644 --- a/src/coreclr/tests/src/CLRTest.Execute.Bash.targets +++ b/src/coreclr/tests/src/CLRTest.Execute.Bash.targets @@ -282,6 +282,10 @@ then else LAUNCHER="$_DebuggerFullPath $(_CLRTestRunFile)" fi +if [ ! -z "$RunNativeAot" ] +then + LAUNCHER="$_DebuggerFullPath" +fi $(BashIlrtTestLaunchCmds) diff --git a/src/coreclr/tests/src/CLRTest.Execute.Batch.targets b/src/coreclr/tests/src/CLRTest.Execute.Batch.targets index 3c800a7ba5eb..c7814fb342b5 100644 --- a/src/coreclr/tests/src/CLRTest.Execute.Batch.targets +++ b/src/coreclr/tests/src/CLRTest.Execute.Batch.targets @@ -297,6 +297,9 @@ IF NOT "%CLRCustomTestLauncher%"=="" ( ) ELSE ( set LAUNCHER=%_DebuggerFullPath% $(_CLRTestRunFile) ) +IF NOT "%RunNativeAot%"=="" ( + set LAUNCHER=%_DebuggerFullPath% +) $(BatchIlrtTestLaunchCmds) diff --git a/src/coreclr/tests/src/CLRTest.Execute.targets b/src/coreclr/tests/src/CLRTest.Execute.targets index 50050e5ee416..5c2ddae6193f 100644 --- a/src/coreclr/tests/src/CLRTest.Execute.targets +++ b/src/coreclr/tests/src/CLRTest.Execute.targets @@ -69,6 +69,7 @@ This file contains the logic for providing Execution Script generation. + diff --git a/src/coreclr/tests/src/CLRTest.NativeAot.targets b/src/coreclr/tests/src/CLRTest.NativeAot.targets new file mode 100644 index 000000000000..64ca7070a6da --- /dev/null +++ b/src/coreclr/tests/src/CLRTest.NativeAot.targets @@ -0,0 +1,140 @@ + + + + $(BashScriptSnippetGen);GetNativeAotBashScript + $(BatchScriptSnippetGen);GetNativeAotBatchScript + + + + + + + + + + + $(BashCLRTestPreCommands);$(NativeAotBashScript) + + + + + + + + + + $(CLRTestBatchPreCommands);$(NativeAotBatchScript) + + + + + + <_NativeAotBuildProjectFile> + + + + $(MSBuildProjectName) + .dll + Exe + %24(MSBuildProjectDirectory)\ + %24(MSBuildProjectDirectory)\ + true + true + + + + + + + + + + + + + + ]]> + + + + + + + + diff --git a/src/coreclr/tests/src/Common/Directory.Build.targets b/src/coreclr/tests/src/Common/Directory.Build.targets index 1a0c14a658ce..ba64d4da4937 100644 --- a/src/coreclr/tests/src/Common/Directory.Build.targets +++ b/src/coreclr/tests/src/Common/Directory.Build.targets @@ -118,6 +118,14 @@ TargetDir="runtime-test/"/> + + + + + + + + - - - + + + $(XunitArgs) -nocolor - $(CORE_ROOT)\corerun - $(CORE_ROOT)\corerun.exe - $(DotnetRoot)/dotnet + $(DotnetRoot)/dotnet