Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 8f9fe6f

Browse files
Merge pull request #85 from PowerShell/AutomationTest
Update Pester test for PSRP to make pass on all platforms
2 parents a3e871c + f791ca3 commit 8f9fe6f

File tree

3 files changed

+37
-34
lines changed

3 files changed

+37
-34
lines changed

test/build.psm1

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#Basic variables initial
22
$DownloadFolder = "https://github.com/PowerShell/PowerShell/releases/download/"
3-
$ReleaseTag = "v6.0.0-alpha.14"
4-
$Endfix = $ReleaseTag.Substring($ReleaseTag.LastIndexOf(".")+1,$ReleaseTag.Length - $ReleaseTag.LastIndexOf(".")-1)
5-
$MSIversion = $ReleaseTag.Substring(1,$ReleaseTag.Length -1 ).Replace("-",".$Endfix-")
3+
$ReleaseTag = "v6.0.0-alpha.16"
4+
#$Endfix = $ReleaseTag.Substring($ReleaseTag.LastIndexOf(".")+1,$ReleaseTag.Length - $ReleaseTag.LastIndexOf(".")-1)
5+
$MSIversion = $ReleaseTag.Substring(1,$ReleaseTag.Length -1 ).Replace("-","-")
66
$version = $MSIversion.Substring(0,$MSIversion.IndexOf("-"))
77
$ReleaseFolder = $DownloadFolder + $ReleaseTag
88
$powershell = "C:\Program Files\PowerShell\$version\powershell.exe"
@@ -13,7 +13,9 @@ function Start-PSRPInstall {
1313
[ValidateSet("win7-x64",
1414
"win7-x86",
1515
"win81-x64",
16-
"win10-x64")]
16+
"win10-x64",
17+
"WS2012R2-x64",
18+
"WS2016-x64")]
1719
[Parameter(ParameterSetName='CoreCLR')]
1820
[string]$Runtime
1921
)
@@ -31,12 +33,12 @@ function Start-PSRPInstall {
3133
}
3234
elseif($Runtime -eq "win81-x64" -or ($Runtime -eq "WS2012R2-x64"))
3335
{
34-
$msiFile = "PowerShell_$MSIversion-win81-x64.msi"
36+
$msiFile = "PowerShell_$MSIversion-win81-win2012r2-x64.msi"
3537
$msiURLFile = $ReleaseFolder+"/"+$msiFile
3638
}
3739
elseif($Runtime -eq "win10-x64" -or ($Runtime -eq "WS2016-x64"))
3840
{
39-
$msiFile = "PowerShell_$MSIversion-win10-x64.msi"
41+
$msiFile = "PowerShell_$MSIversion-win10-win2016-x64.msi"
4042
$msiURLFile = $ReleaseFolder+"/"+$msiFile
4143
}
4244
else
@@ -63,7 +65,8 @@ function Start-PSRPInstall {
6365
"win7-x86",
6466
"win81-x64",
6567
"win10-x64",
66-
"osx.10.11-x64")]
68+
"WS2012R2-x64",
69+
"WS2016-x64")]
6770
[Parameter(ParameterSetName='CoreCLR')]
6871
[string]$Runtime
6972
)

test/installPSRP.sh

100755100644
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trap '
88
' INT
99

1010
if [ $# -ne 3 ]; then
11-
echo -e "Need redmondpassword with omiversion and psrpversion\nUsage:installPSRP.sh redmondpassword \"1.1.0-63\" \"6\""
11+
echo -e "Need redmondpassword with omiversion and psrpversion\nUsage:installPSRP.sh redmondpassword \"1.2.0-35\" \"18\""
1212
exit 2
1313
fi
1414

@@ -19,8 +19,8 @@ redmondpassword=$1
1919
isMacOS=false
2020
omiversion=$2
2121
psrpversion=$3
22-
powershellDir="/opt/microsoft/powershell/6.0.0-alpha.14"
23-
powershellDirForMac="/usr/local/microsoft/powershell/6.0.0-alpha.14"
22+
powershellDir="/opt/microsoft/powershell/6.0.0-alpha.16"
23+
powershellDirForMac="/usr/local/microsoft/powershell/6.0.0-alpha.16"
2424
realdataDir="//osfiler/ostcdata$"
2525
get_omifolder() {
2626
echo "/download/OSTCData/Builds/omi/develop/$1/$2/$3"
@@ -72,7 +72,7 @@ case "$OSTYPE" in
7272
platfrom=Linux_ULINUX_1.0_x64_64_Release
7373
;;
7474
*)
75-
echo "Ubuntu $VERSION_ID is not supported!" >&2
75+
echo "Ubuntu $VERSION_ID is not supported!"
7676
exit 2
7777
esac
7878

@@ -83,7 +83,7 @@ case "$OSTYPE" in
8383
esac
8484
;;
8585
*)
86-
echo "$NAME is not supported!" >&2
86+
echo "$NAME is not supported!"
8787
exit 2
8888
esac
8989
;;
@@ -95,7 +95,7 @@ case "$OSTYPE" in
9595
powershellDir=$powershellDirForMac
9696
;;
9797
*)
98-
echo "$OSTYPE is not supported!" >&2
98+
echo "$OSTYPE is not supported!"
9999
exit 2
100100
;;
101101
esac
@@ -117,15 +117,17 @@ if [ "$isMacOS" = "true" ]; then
117117
# Mac OS don't have mount_cifs, so use mount_smbfs
118118
omifolder=$(get_omifolder "$omiversion" "$platfrom" "$opensslversion")
119119
echo "mounting from $realdataDir folder to omi folder: $omifolder"
120-
sudo mount -t smbfs '//redmond.corp.microsoft.com;scxsvc:'"$redmondpassword"'@osfiler/ostcdata$' /download
120+
#sudo mount -t smbfs '//redmond.corp.microsoft.com;scxsvc:'"$redmondpassword"'@osfiler/ostcdata$' /download
121+
sudo mount osfiler.scx.com:/OSTCData /download
121122
sudo cp -f $omifolder"omicli" /opt/omi/bin
122123
sudo cp -f $omifolder"libmi.dylib" /opt/omi/lib
123-
#sudo cp -f $omifolder"libmi.dylib" $powershellDir
124+
sudo cp -f $omifolder"libmi.dylib" $powershellDir
124125
sudo umount /download
125126

126127
psrpfolder=$(get_psrpfolder "$psrpversion" "$platfrom")
127128
echo "mounting from $realdataDir folder to psrp folder: $psrpfolder"
128-
sudo mount -t smbfs '//redmond.corp.microsoft.com;scxsvc:'"$redmondpassword"'@osfiler/ostcdata$' /download
129+
#sudo mount -t smbfs '//redmond.corp.microsoft.com;scxsvc:'"$redmondpassword"'@osfiler/ostcdata$' /download
130+
sudo mount osfiler.scx.com:/OSTCData /download
129131
echo "Copying psrpclient ..."
130132
sudo cp -f $psrpfolder/libpsrpclient.dylib $powershellDir
131133
sudo umount /download
@@ -154,47 +156,45 @@ case "$OSTYPE" in
154156
# yum automatically resolves dependencies for local packages
155157
omipackage=omi-$omiversion.ulinux.x64.rpm
156158
if [[ ! -r "$omipackage" ]]; then
157-
echo "ERROR: $omipackage failed to download! Aborting..." >&2
159+
echo "ERROR: $omipackage failed to download! Aborting..."
158160
exit 1
159161
fi
160162
sudo rpm -i "./$omipackage"
161163
echo "Done installing omi ..."
162164

163-
psrppackage=psrp-1.0.0-0.universal.x64.rpm
165+
psrppackage=psrp-1.0.0-$psrpversion.universal.x64.rpm
164166
if [[ ! -r "$psrppackage" ]]; then
165-
echo "ERROR: $psrppackage failed to download! Aborting..." >&2
167+
echo "ERROR: $psrppackage failed to download! Aborting..."
166168
exit 1
167169
fi
168170
sudo rpm -i "./$psrppackage"
169171
echo "Done installing psrp ..."
170172

171173
#echo "Copying omicli and psrpclient ..."
172-
#libmi.so and libpsrpclient.so are integrated into powershell package, so needn't to copy them from build share folder
173-
#sudo cp -u libmi.so $powershellDir
174-
#sudo cp -u libpsrpclient.so $powershellDir
174+
sudo cp -u libmi.so $powershellDir
175+
sudo cp -u libpsrpclient.so $powershellDir
175176
;;
176177
ubuntu)
177178
# dpkg does not automatically resolve dependencies, but spouts ugly errors
178179
omipackage=omi-$omiversion.ulinux.x64.deb
179180
if [[ ! -r "$omipackage" ]]; then
180-
echo "ERROR: $omipackage failed to download! Aborting..." >&2
181+
echo "ERROR: $omipackage failed to download! Aborting..."
181182
exit 1
182183
fi
183184
sudo dpkg -i "./$omipackage"
184185
echo "Done installing omi ..."
185186

186-
psrppackage=psrp-1.0.0-0.universal.x64.deb
187+
psrppackage=psrp-1.0.0-$psrpversion.universal.x64.deb
187188
if [[ ! -r "$psrppackage" ]]; then
188-
echo "ERROR: $psrppackage failed to download! Aborting..." >&2
189+
echo "ERROR: $psrppackage failed to download! Aborting..."
189190
exit 1
190191
fi
191-
sudo dpkg -i "./$psrppackage" &> /dev/null
192+
sudo dpkg -i "./$psrppackage"
192193
echo "Done installing psrp ..."
193194

194195
#echo "Copying omicli and psrpclient ..."
195-
#libmi.so and libpsrpclient.so are integrated into powershell package, so needn't to copy them from build share folder
196-
#sudo cp -u libmi.so $powershellDir
197-
#sudo cp -u libpsrpclient.so $powershellDir
196+
sudo cp -u libmi.so $powershellDir
197+
sudo cp -u libpsrpclient.so $powershellDir
198198
# Resolve dependencies
199199
sudo apt-get install -f -y
200200
;;
@@ -208,7 +208,7 @@ esac
208208
success=$?
209209

210210
if [[ "$success" != 0 ]]; then
211-
echo "OMI and PSRP install failed." >&2
211+
echo "OMI and PSRP install failed."
212212
exit "$success"
213213
else
214214
echo "Congratulations! OMI and PSRP are installed."

test/installpowershell.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ trap '
77
kill -s INT "$$"
88
' INT
99

10-
releaseversion="6.0.0-alpha.14"
11-
centosreleaseversion="6.0.0_alpha.14"
10+
releaseversion="6.0.0-alpha.16"
11+
centosreleaseversion="6.0.0_alpha.16"
1212
get_url() {
13-
release=v6.0.0-alpha.14
13+
release=v6.0.0-alpha.16
1414
echo "https://github.com/PowerShell/PowerShell/releases/download/$release/$1"
1515
}
1616

@@ -84,7 +84,7 @@ case "$OSTYPE" in
8484
# dpkg does not automatically resolve dependencies, but spouts ugly errors
8585
sudo dpkg -i "./$package" &> /dev/null
8686
# Resolve dependencies
87-
sudo apt-get install -f
87+
sudo apt-get install -fy
8888
;;
8989
*)
9090
esac

0 commit comments

Comments
 (0)