From 4d8b02dd6719cd4534954e3e485bc32269b02452 Mon Sep 17 00:00:00 2001 From: Chris Rummel Date: Fri, 19 Jun 2020 14:47:22 -0500 Subject: [PATCH] Add self-contained and framework-dependent publish tests. (#1628) * Add self-contained and framework-dependent publish tests. --- smoke-test.sh | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/smoke-test.sh b/smoke-test.sh index 449e50bdbf..222476f383 100755 --- a/smoke-test.sh +++ b/smoke-test.sh @@ -7,6 +7,7 @@ VERSION_PREFIX=3.1 # needs to be compatible with the runtime produced from source-build DEV_CERTS_VERSION_DEFAULT=3.0.0-preview8-28405-07 __ROOT_REPO=$(cat "$SCRIPT_ROOT/artifacts/obj/rootrepo.txt" | sed 's/\r$//') # remove CR if mounted repo on Windows drive +targetRid=$(cat "$SCRIPT_ROOT/artifacts/obj/x64/Release/TargetInfo.props" | grep -i targetrid | sed -E 's|\s*\s*||g') export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 @@ -38,6 +39,7 @@ function usage() { echo "usage:" echo " --dotnetDir the directory from which to run dotnet" echo " --configuration the configuration being tested (default=Release)" + echo " --targetRid override the target rid to use when needed (e.g. for self-contained publish tests)" echo " --projectOutput echo dotnet's output to console" echo " --keepProjects keep projects after tests are complete" echo " --minimal run minimal set of tests - local sources only, no web" @@ -74,6 +76,10 @@ while :; do shift configuration="$1" ;; + --targetrid) + shift + targetRid="$1" + ;; --projectoutput) projectOutput=true ;; @@ -167,7 +173,8 @@ function doCommand() { binlogHttpsPart="https" fi - binlog="$testingDir/${lang}_${proj}_${binlogOnlinePart}_${binlogHttpsPart}_$1.binlog" + binlogPrefix="$testingDir/${lang}_${proj}_${binlogOnlinePart}_${binlogHttpsPart}_" + binlog="${binlogPrefix}$1.binlog" echo " running $1" | tee -a "$logFile" if [ "$1" == "new" ]; then @@ -197,6 +204,17 @@ function doCommand() { $killCommand wait $! echo " terminated with exit code $?" | tee -a "$logFile" + elif [ "$1" == "publish" ]; then + runPublishScenarios() { + "${dotnetCmd}" publish --self-contained false /bl:"${binlogPrefix}publish-fx-dep.binlog" + "${dotnetCmd}" publish --self-contained true -r $targetRid /bl:"${binlogPrefix}publish-self-contained-${targetRid}.binlog" + "${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-portable.binlog" + } + if [ "$projectOutput" == "true" ]; then + runPublishScenarios | tee -a "$logFile" + else + runPublishScenarios >> "$logFile" 2>&1 + fi else if [ "$projectOutput" == "true" ]; then "${dotnetCmd}" $1 /bl:"$binlog" | tee -a "$logFile" @@ -235,18 +253,18 @@ function setupDevCerts() { function runAllTests() { # Run tests for each language and template if [ "$excludeNonWebTests" == "false" ]; then - doCommand C# console new restore build run - doCommand C# classlib new restore build + doCommand C# console new restore build run publish + doCommand C# classlib new restore build publish doCommand C# xunit new restore test doCommand C# mstest new restore test - doCommand VB console new restore build run - doCommand VB classlib new restore build + doCommand VB console new restore build run publish + doCommand VB classlib new restore build publish doCommand VB xunit new restore test doCommand VB mstest new restore test - doCommand F# console new restore build run - doCommand F# classlib new restore build + doCommand F# console new restore build run publish + doCommand F# classlib new restore build publish doCommand F# xunit new restore test doCommand F# mstest new restore test fi @@ -276,14 +294,14 @@ function resetCaches() { } function runWebTests() { - doCommand C# web "$@" new restore build run - doCommand C# mvc "$@" new restore build run - doCommand C# webapi "$@" new restore build run - doCommand C# razor "$@" new restore build run - - doCommand F# web "$@" new restore build run - doCommand F# mvc "$@" new restore build run - doCommand F# webapi "$@" new restore build run + doCommand C# web "$@" new restore build run publish + doCommand C# mvc "$@" new restore build run publish + doCommand C# webapi "$@" new restore build run publish + doCommand C# razor "$@" new restore build run publish + + doCommand F# web "$@" new restore build run publish + doCommand F# mvc "$@" new restore build run publish + doCommand F# webapi "$@" new restore build run publish } function resetCaches() {