From 70d4ec43968d05dc32907a007fd76db8643ddb05 Mon Sep 17 00:00:00 2001 From: qiaopengcheng Date: Wed, 24 Aug 2022 09:24:38 +0800 Subject: [PATCH 1/3] [LoongArch64] supporting `src/tests/run.sh` on LA64. --- src/coreclr/scripts/coreclr_arguments.py | 2 +- src/tests/run.sh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/coreclr/scripts/coreclr_arguments.py b/src/coreclr/scripts/coreclr_arguments.py index aab997306f190..a568bc9e78e71 100644 --- a/src/coreclr/scripts/coreclr_arguments.py +++ b/src/coreclr/scripts/coreclr_arguments.py @@ -63,7 +63,7 @@ def __init__(self, self.require_built_core_root = require_built_core_root self.require_built_test_dir = require_built_test_dir - self.valid_arches = ["x64", "x86", "arm", "arm64", "wasm"] + self.valid_arches = ["x64", "x86", "arm", "arm64", "loongarch64", "wasm"] self.valid_build_types = ["Debug", "Checked", "Release"] self.valid_host_os = ["windows", "OSX", "Linux", "illumos", "Solaris", "Browser", "Android"] diff --git a/src/tests/run.sh b/src/tests/run.sh index 16756ccf61f17..6f08a6203e092 100755 --- a/src/tests/run.sh +++ b/src/tests/run.sh @@ -11,7 +11,7 @@ function print_usage { echo 'Optional arguments:' echo ' -h|--help : Show usage information.' echo ' -v, --verbose : Show output from each test.' - echo ' : One of x64, x86, arm, arm64, loongarch64, riscv64, wasm. Defaults to current architecture.' + echo ' : One of x64, x86, arm, arm64, loongarch64, riscv64, wasm. Defaults to x64.' echo ' Android : Set build OS to Android.' echo ' --test-env= : Script to set environment variables for tests' echo ' --testRootDir= : Root directory of the test build (e.g. runtime/artifacts/tests/windows.x64.Debug).' @@ -129,6 +129,9 @@ do arm64) buildArch="arm64" ;; + loongarch64) + buildArch="loongarch64" + ;; wasm) buildArch="wasm" ;; From 3b46bfaa6c60dfce83476fd11d8852bdbae9c8a3 Mon Sep 17 00:00:00 2001 From: qiaopengcheng Date: Wed, 24 Aug 2022 10:15:44 +0800 Subject: [PATCH 2/3] amend getting the `arch` for CR. --- eng/native/init-os-and-arch.sh | 8 +++--- src/tests/run.sh | 47 +++------------------------------- 2 files changed, 7 insertions(+), 48 deletions(-) diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh index 887bb3b72f786..738b4e55b806a 100644 --- a/eng/native/init-os-and-arch.sh +++ b/eng/native/init-os-and-arch.sh @@ -13,8 +13,8 @@ FreeBSD|Linux|NetBSD|OpenBSD|SunOS|Android) Darwin) os=OSX ;; *) - echo "Unsupported OS $OSName detected, configuring as if for Linux" - os=Linux ;; + echo "Unsupported OS $OSName detected !" + exit 1 ;; esac # On Solaris, `uname -m` is discouraged, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html @@ -74,7 +74,7 @@ case "$CPUName" in arch=ppc64le ;; *) - echo "Unknown CPU $CPUName detected, configuring as if for x64" - arch=x64 + echo "Unknown CPU $CPUName detected!" + exit 1 ;; esac diff --git a/src/tests/run.sh b/src/tests/run.sh index 6f08a6203e092..d2a74b457482e 100755 --- a/src/tests/run.sh +++ b/src/tests/run.sh @@ -11,7 +11,7 @@ function print_usage { echo 'Optional arguments:' echo ' -h|--help : Show usage information.' echo ' -v, --verbose : Show output from each test.' - echo ' : One of x64, x86, arm, arm64, loongarch64, riscv64, wasm. Defaults to x64.' + echo ' : One of x64, x86, arm, arm64, loongarch64, riscv64, wasm. Defaults to current architecture.' echo ' Android : Set build OS to Android.' echo ' --test-env= : Script to set environment variables for tests' echo ' --testRootDir= : Root directory of the test build (e.g. runtime/artifacts/tests/windows.x64.Debug).' @@ -39,55 +39,14 @@ function print_usage { echo ' --limitedDumpGeneration : ' } -function check_cpu_architecture { - local CPUName=$(uname -m) - local __arch= - - if [[ "$(uname -s)" == "SunOS" ]]; then - CPUName=$(isainfo -n) - fi - - case $CPUName in - i686) - __arch=x86 - ;; - amd64|x86_64) - __arch=x64 - ;; - armv7l) - __arch=arm - ;; - aarch64|arm64) - __arch=arm64 - ;; - loongarch64) - __arch=loongarch64 - ;; - riscv64) - __arch=riscv64 - ;; - *) - echo "Unknown CPU $CPUName detected, configuring as if for x64" - __arch=x64 - ;; - esac - - echo "$__arch" -} - -################################################################################ -# Handle Arguments -################################################################################ - -ARCH=$(check_cpu_architecture) - # Exit code constants readonly EXIT_CODE_SUCCESS=0 # Script ran normally. readonly EXIT_CODE_EXCEPTION=1 # Script exited because something exceptional happened (e.g. bad arguments, Ctrl-C interrupt). readonly EXIT_CODE_TEST_FAILURE=2 # Script completed successfully, but one or more tests failed. # Argument variables -buildArch=$ARCH +source "$repoRootDir/eng/native/init-os-and-arch.sh" +buildArch="$arch" buildOS= buildConfiguration="Debug" testRootDir= From a74264301c4937645603f0e72e71628f1fd747c2 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sat, 27 Aug 2022 16:00:34 -0700 Subject: [PATCH 3/3] Update eng/native/init-os-and-arch.sh --- eng/native/init-os-and-arch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh index 738b4e55b806a..4064314011391 100644 --- a/eng/native/init-os-and-arch.sh +++ b/eng/native/init-os-and-arch.sh @@ -13,7 +13,7 @@ FreeBSD|Linux|NetBSD|OpenBSD|SunOS|Android) Darwin) os=OSX ;; *) - echo "Unsupported OS $OSName detected !" + echo "Unsupported OS $OSName detected!" exit 1 ;; esac