-
Notifications
You must be signed in to change notification settings - Fork 864
Expand file tree
/
Copy pathTestDesignTimeProviderPackaging.sh
More file actions
executable file
·139 lines (117 loc) · 6.19 KB
/
Copy pathTestDesignTimeProviderPackaging.sh
File metadata and controls
executable file
·139 lines (117 loc) · 6.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env bash
#
# End to end tests for DesignTimeProviderPackaging
# Tests the conditional inclusion of PackageFSharpDesignTimeTools target
#
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
configuration=Debug
while [[ $# -gt 0 ]]; do
case $1 in
-c)
configuration="$2"
shift 2
;;
*)
echo "Unsupported argument: $1"
exit 1
;;
esac
done
cd "$SCRIPT_DIR"
# Clean artifacts
rm -rf artifacts
mkdir -p artifacts
echo
echo "=== Test 1: Plain Library (No Provider) ==="
echo "[Test 1] Packing PlainLib without IsFSharpDesignTimeProvider property..."
echo "[Test 1] Command: dotnet pack PlainLib/PlainLib.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/plain.binlog -p:FSharpTestCompilerVersion=coreclr"
if ! dotnet pack PlainLib/PlainLib.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/plain.binlog -p:FSharpTestCompilerVersion=coreclr; then
echo "[Test 1] FAILED: Pack command returned error code $?"
echo "[Test 1] Check artifacts/plain.binlog for details"
exit 1
fi
# Check that no tools folder exists in nupkg
echo "[Test 1] Checking that package does not contain tools/fsharp41 folder..."
if unzip -l artifacts/PlainLib.1.0.0.nupkg | grep -q "tools/fsharp41/"; then
echo "[Test 1] FAILED: Package unexpectedly contains tools/fsharp41 folder"
echo "[Test 1] Expected: No tools folder for plain library"
echo "[Test 1] Actual: tools/fsharp41 folder found in PlainLib.1.0.0.nupkg"
exit 1
fi
echo "[Test 1] PASSED: Plain library test passed"
echo
echo "=== Test 2: Provider Project (Direct Flag) ==="
echo "[Test 2] Packing Provider with IsFSharpDesignTimeProvider=true..."
echo "[Test 2] Command: dotnet pack Provider/Provider.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/provider.binlog -p:FSharpTestCompilerVersion=coreclr"
if ! dotnet pack Provider/Provider.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/provider.binlog -p:FSharpTestCompilerVersion=coreclr; then
echo "[Test 2] FAILED: Pack command returned error code $?"
echo "[Test 2] Check artifacts/provider.binlog for details"
exit 1
fi
# Check that tools folder exists in nupkg
echo "[Test 2] Checking that package contains tools/fsharp41 folder..."
if ! unzip -l artifacts/Provider.1.0.0.nupkg | grep -q "tools/fsharp41/"; then
echo "[Test 2] FAILED: Package does not contain tools/fsharp41 folder"
echo "[Test 2] Expected: tools/fsharp41 folder should be present in provider package"
echo "[Test 2] Actual: No tools/fsharp41 folder found in Provider.1.0.0.nupkg"
exit 1
fi
echo "[Test 2] PASSED: Provider test passed"
echo
echo "=== Test 3: Host with ProjectReference to Provider ==="
echo "[Test 3] Packing Host that activates a design-time provider via ProjectReference metadata..."
echo "[Test 3] Command: dotnet pack Host/Host.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/host.binlog -p:FSharpTestCompilerVersion=coreclr"
if ! dotnet pack Host/Host.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/host.binlog -p:FSharpTestCompilerVersion=coreclr; then
echo "[Test 3] FAILED: Pack command returned error code $?"
echo "[Test 3] Check artifacts/host.binlog for details"
exit 1
fi
# Check that tools folder exists in nupkg (provider activated via ProjectReference IsFSharpDesignTimeProvider metadata)
echo "[Test 3] Checking that package contains tools/fsharp41 folder..."
if ! unzip -l artifacts/Host.1.0.0.nupkg | grep -q "tools/fsharp41/"; then
echo "[Test 3] FAILED: Package does not contain tools/fsharp41 folder"
echo "[Test 3] Expected: provider referenced via ProjectReference should be packaged"
echo "[Test 3] Actual: No tools/fsharp41 folder found in Host.1.0.0.nupkg"
exit 1
fi
echo "[Test 3] PASSED: Host (ProjectReference gesture) test passed"
echo
echo "=== Test 4: Pack with --no-build (No Provider) ==="
echo "[Test 4] Testing pack --no-build scenario (NETSDK1085 regression test)..."
echo "[Test 4] Building PlainLib first..."
echo "[Test 4] Command: dotnet build PlainLib/PlainLib.fsproj -c $configuration"
if ! dotnet build PlainLib/PlainLib.fsproj -c $configuration; then
echo "[Test 4] FAILED: Build command returned error code $?"
exit 1
fi
echo "[Test 4] Packing with --no-build flag..."
echo "[Test 4] Command: dotnet pack PlainLib/PlainLib.fsproj --no-build -o artifacts -c $configuration -v minimal -bl:artifacts/nobuild.binlog -p:FSharpTestCompilerVersion=coreclr"
if ! dotnet pack PlainLib/PlainLib.fsproj --no-build -o artifacts -c $configuration -v minimal -bl:artifacts/nobuild.binlog -p:FSharpTestCompilerVersion=coreclr; then
echo "[Test 4] FAILED: Pack --no-build returned error code $?"
echo "[Test 4] This indicates NETSDK1085 or similar issue - early target execution"
echo "[Test 4] Check artifacts/nobuild.binlog for details"
exit 1
fi
echo "[Test 4] PASSED: No-build test passed"
echo
echo "=== Test 5: Binding Redirect / App.config Interaction ==="
echo "[Test 5] Testing with AutoGenerateBindingRedirects (MSB3030/app.config regression test)..."
echo "[Test 5] Command: dotnet pack RedirectLib/RedirectLib.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/redirect.binlog -p:FSharpTestCompilerVersion=coreclr"
if ! dotnet pack RedirectLib/RedirectLib.fsproj -o artifacts -c $configuration -v minimal -bl:artifacts/redirect.binlog -p:FSharpTestCompilerVersion=coreclr; then
echo "[Test 5] FAILED: Pack command returned error code $?"
echo "[Test 5] Check artifacts/redirect.binlog for MSB3030 or binding redirect issues"
exit 1
fi
# Check that no tools folder exists in nupkg (target should not have run)
echo "[Test 5] Checking that package does not contain tools/fsharp41 folder..."
if unzip -l artifacts/RedirectLib.1.0.0.nupkg | grep -q "tools/fsharp41/"; then
echo "[Test 5] FAILED: Package unexpectedly contains tools/fsharp41 folder"
echo "[Test 5] Expected: No tools folder for library without IsFSharpDesignTimeProvider"
echo "[Test 5] Actual: tools/fsharp41 folder found - may indicate unwanted target execution"
exit 1
fi
echo "[Test 5] PASSED: Redirect test passed"
echo
echo "=== All DesignTimeProviderPackaging tests PASSED ==="
exit 0