File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # Run PowerShell command to check installation
4- pwsh --version & > /dev/null
5-
6- # Check if the command was successful
7- if [ $? -eq 0 ]; then
8- echo " PowerShell is installed."
9- else
10- echo " PowerShell is not installed."
11- exit 1
12- fi
3+ set -e
4+
5+ # Import test library for `check` command
6+ source dev-container-features-test-lib
7+
8+ # Extension-specific tests
9+ check " pwsh file is symlink" bash -c " [ -L /usr/bin/pwsh ]"
10+ check " pwsh symlink is registered as shell" bash -c " [ $( grep -c ' /usr/bin/pwsh' /etc/shells) -ge 1 ]"
11+ check " pwsh target is correct" bash -c " [ $( readlink /usr/bin/pwsh) = /opt/microsoft/powershell/7/pwsh ]"
12+ check " pwsh owner is root" bash -c " [ $( stat -c %U /opt/microsoft/powershell/7/pwsh) = root ]"
13+ check " pwsh group is root" bash -c " [ $( stat -c %G /opt/microsoft/powershell/7/pwsh) = root ]"
14+ check " pwsh file mode is -rwxr-xr-x" bash -c " [ $( stat -c ' %A' /opt/microsoft/powershell/7/pwsh) = '-rwxr-xr-x' ]"
15+ check " pwsh is in PATH" bash -c " command -v pwsh"
16+
17+ # Report result
18+ reportResults
You can’t perform that action at this time.
0 commit comments