Skip to content

Commit 4d8b02d

Browse files
authored
Add self-contained and framework-dependent publish tests. (#1628)
* Add self-contained and framework-dependent publish tests.
1 parent e89f045 commit 4d8b02d

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

smoke-test.sh

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ VERSION_PREFIX=3.1
77
# needs to be compatible with the runtime produced from source-build
88
DEV_CERTS_VERSION_DEFAULT=3.0.0-preview8-28405-07
99
__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')
1011

1112
export DOTNET_CLI_TELEMETRY_OPTOUT=1
1213
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
@@ -38,6 +39,7 @@ function usage() {
3839
echo "usage:"
3940
echo " --dotnetDir the directory from which to run dotnet"
4041
echo " --configuration the configuration being tested (default=Release)"
42+
echo " --targetRid override the target rid to use when needed (e.g. for self-contained publish tests)"
4143
echo " --projectOutput echo dotnet's output to console"
4244
echo " --keepProjects keep projects after tests are complete"
4345
echo " --minimal run minimal set of tests - local sources only, no web"
@@ -74,6 +76,10 @@ while :; do
7476
shift
7577
configuration="$1"
7678
;;
79+
--targetrid)
80+
shift
81+
targetRid="$1"
82+
;;
7783
--projectoutput)
7884
projectOutput=true
7985
;;
@@ -167,7 +173,8 @@ function doCommand() {
167173
binlogHttpsPart="https"
168174
fi
169175

170-
binlog="$testingDir/${lang}_${proj}_${binlogOnlinePart}_${binlogHttpsPart}_$1.binlog"
176+
binlogPrefix="$testingDir/${lang}_${proj}_${binlogOnlinePart}_${binlogHttpsPart}_"
177+
binlog="${binlogPrefix}$1.binlog"
171178
echo " running $1" | tee -a "$logFile"
172179

173180
if [ "$1" == "new" ]; then
@@ -197,6 +204,17 @@ function doCommand() {
197204
$killCommand
198205
wait $!
199206
echo " terminated with exit code $?" | tee -a "$logFile"
207+
elif [ "$1" == "publish" ]; then
208+
runPublishScenarios() {
209+
"${dotnetCmd}" publish --self-contained false /bl:"${binlogPrefix}publish-fx-dep.binlog"
210+
"${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"
212+
}
213+
if [ "$projectOutput" == "true" ]; then
214+
runPublishScenarios | tee -a "$logFile"
215+
else
216+
runPublishScenarios >> "$logFile" 2>&1
217+
fi
200218
else
201219
if [ "$projectOutput" == "true" ]; then
202220
"${dotnetCmd}" $1 /bl:"$binlog" | tee -a "$logFile"
@@ -235,18 +253,18 @@ function setupDevCerts() {
235253
function runAllTests() {
236254
# Run tests for each language and template
237255
if [ "$excludeNonWebTests" == "false" ]; then
238-
doCommand C# console new restore build run
239-
doCommand C# classlib new restore build
256+
doCommand C# console new restore build run publish
257+
doCommand C# classlib new restore build publish
240258
doCommand C# xunit new restore test
241259
doCommand C# mstest new restore test
242260

243-
doCommand VB console new restore build run
244-
doCommand VB classlib new restore build
261+
doCommand VB console new restore build run publish
262+
doCommand VB classlib new restore build publish
245263
doCommand VB xunit new restore test
246264
doCommand VB mstest new restore test
247265

248-
doCommand F# console new restore build run
249-
doCommand F# classlib new restore build
266+
doCommand F# console new restore build run publish
267+
doCommand F# classlib new restore build publish
250268
doCommand F# xunit new restore test
251269
doCommand F# mstest new restore test
252270
fi
@@ -276,14 +294,14 @@ function resetCaches() {
276294
}
277295

278296
function runWebTests() {
279-
doCommand C# web "$@" new restore build run
280-
doCommand C# mvc "$@" new restore build run
281-
doCommand C# webapi "$@" new restore build run
282-
doCommand C# razor "$@" new restore build run
283-
284-
doCommand F# web "$@" new restore build run
285-
doCommand F# mvc "$@" new restore build run
286-
doCommand F# webapi "$@" new restore build run
297+
doCommand C# web "$@" new restore build run publish
298+
doCommand C# mvc "$@" new restore build run publish
299+
doCommand C# webapi "$@" new restore build run publish
300+
doCommand C# razor "$@" new restore build run publish
301+
302+
doCommand F# web "$@" new restore build run publish
303+
doCommand F# mvc "$@" new restore build run publish
304+
doCommand F# webapi "$@" new restore build run publish
287305
}
288306

289307
function resetCaches() {

0 commit comments

Comments
 (0)