Skip to content

Commit

Permalink
amend getting the arch for CR.
Browse files Browse the repository at this point in the history
  • Loading branch information
shushanhf committed Aug 24, 2022
1 parent 70d4ec4 commit 3b46bfa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 48 deletions.
8 changes: 4 additions & 4 deletions eng/native/init-os-and-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
47 changes: 3 additions & 44 deletions src/tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' <arch> : One of x64, x86, arm, arm64, loongarch64, riscv64, wasm. Defaults to x64.'
echo ' <arch> : One of x64, x86, arm, arm64, loongarch64, riscv64, wasm. Defaults to current architecture.'
echo ' Android : Set build OS to Android.'
echo ' --test-env=<path> : Script to set environment variables for tests'
echo ' --testRootDir=<path> : Root directory of the test build (e.g. runtime/artifacts/tests/windows.x64.Debug).'
Expand Down Expand Up @@ -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=
Expand Down

0 comments on commit 3b46bfa

Please sign in to comment.