Skip to content

Commit a043885

Browse files
authored
Fix smoke-test.sh to work on arm64 (#1652)
Before this change, running smoke tests on arm64 using: ./build.sh ./build.sh --run-smoke-test fails with an error that looks like this: cat: source-build/artifacts/obj/x64/Release/TargetInfo.props: No such file or directory It turns out that smoke-test.sh hardcodes `x64` throughout. Fix that by checking the current architecture (using `uname -m` and `uname -p`) and then using that instead of hardcoded `x64`.
1 parent 1eba1a6 commit a043885

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

smoke-test.sh

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,35 @@ VERSION_PREFIX=3.1
66
# See https://github.com/dotnet/source-build/issues/579, this version
77
# needs to be compatible with the runtime produced from source-build
88
DEV_CERTS_VERSION_DEFAULT=3.0.0-preview8-28405-07
9+
10+
# Use uname to determine what the CPU is.
11+
cpuName=$(uname -p)
12+
# Some Linux platforms report unknown for platform, but the arch for machine.
13+
if [[ "$cpuName" == "unknown" ]]; then
14+
cpuName=$(uname -m)
15+
fi
16+
17+
case $cpuName in
18+
aarch64)
19+
buildArch=arm64
20+
;;
21+
amd64|x86_64)
22+
buildArch=x64
23+
;;
24+
armv*l)
25+
buildArch=arm
26+
;;
27+
i686)
28+
buildArch=x86
29+
;;
30+
*)
31+
echo "Unknown CPU $cpuName detected, treating it as x64"
32+
buildArch=x64
33+
;;
34+
esac
35+
936
__ROOT_REPO=$(cat "$SCRIPT_ROOT/artifacts/obj/rootrepo.txt" | sed 's/\r$//') # remove CR if mounted repo on Windows drive
10-
targetRid=$(cat "$SCRIPT_ROOT/artifacts/obj/x64/Release/TargetInfo.props" | grep -i targetrid | sed -E 's|\s*</?TargetRid>\s*||g')
37+
targetRid=$(cat "$SCRIPT_ROOT/artifacts/obj/${buildArch}/Release/TargetInfo.props" | grep -i targetrid | sed -E 's|\s*</?TargetRid>\s*||g')
1138

1239
export DOTNET_CLI_TELEMETRY_OPTOUT=1
1340
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
@@ -208,7 +235,7 @@ function doCommand() {
208235
runPublishScenarios() {
209236
"${dotnetCmd}" publish --self-contained false /bl:"${binlogPrefix}publish-fx-dep.binlog"
210237
"${dotnetCmd}" publish --self-contained true -r $targetRid /bl:"${binlogPrefix}publish-self-contained-${targetRid}.binlog"
211-
"${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-portable.binlog"
238+
"${dotnetCmd}" publish --self-contained true -r linux-${buildArch} /bl:"${binlogPrefix}publish-self-contained-portable.binlog"
212239
}
213240
if [ "$projectOutput" == "true" ]; then
214241
runPublishScenarios | tee -a "$logFile"
@@ -360,7 +387,7 @@ echo "<Project />" | tee Directory.Build.props > Directory.Build.targets
360387

361388
# Unzip dotnet if the dotnetDir is not specified
362389
if [ "$dotnetDir" == "" ]; then
363-
OUTPUT_DIR="$SCRIPT_ROOT/artifacts/x64/$configuration/"
390+
OUTPUT_DIR="$SCRIPT_ROOT/artifacts/${buildArch}/$configuration/"
364391
DOTNET_TARBALL="$(ls ${OUTPUT_DIR}dotnet-sdk-${VERSION_PREFIX}*)"
365392

366393
mkdir -p "$cliDir"
@@ -377,7 +404,7 @@ echo SDK under test is:
377404

378405
# setup restore path
379406
export NUGET_PACKAGES="$restoredPackagesDir"
380-
SOURCE_BUILT_PKGS_PATH="$SCRIPT_ROOT/artifacts/obj/x64/$configuration/blob-feed/packages/"
407+
SOURCE_BUILT_PKGS_PATH="$SCRIPT_ROOT/artifacts/obj/${buildArch}/$configuration/blob-feed/packages/"
381408
export DOTNET_ROOT="$dotnetDir"
382409
# OSX also requires DOTNET_ROOT to be on the PATH
383410
if [ "$(uname)" == 'Darwin' ]; then

0 commit comments

Comments
 (0)