Skip to content

Commit

Permalink
set tests to run in bash strict mode (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicrowe00 authored Dec 13, 2023
1 parent 354d765 commit 91d4b85
Show file tree
Hide file tree
Showing 42 changed files with 43 additions and 19 deletions.
1 change: 1 addition & 0 deletions apphost-framework-lookup/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fi
# because that usually contains lots of "errors".

set -euo pipefail
IFS=$'\n\t'
set -x

runtime_id="$(../runtime-id --portable)"
Expand Down
2 changes: 1 addition & 1 deletion aspnet-same-runtime-version-2x/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

# There's always a version of Microsoft.AspNetCore.App for each
Expand Down
1 change: 1 addition & 0 deletions aspnet-same-runtime-version/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

# Check Microsoft.AspNetCore.App's version matches that of Microsoft.NETCore.App

Expand Down
1 change: 1 addition & 0 deletions aspnetpatch-21/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

# Ensure we have an up-to-date value for latest_aspnet_package.
Expand Down
1 change: 1 addition & 0 deletions bash-completion/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

Expand Down
2 changes: 1 addition & 1 deletion bundled-libunwind/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

framework_dir=$(../dotnet-directory --framework "$1")
Expand Down
2 changes: 1 addition & 1 deletion cgroup-limit/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

runtime_id="$(../runtime-id)"
Expand Down
1 change: 0 additions & 1 deletion commit-ids-in-binaries/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

set -euo pipefail
IFS=$'\n\t'

set -x

dotnet_home="$(dirname "$(readlink -f "$(command -v dotnet)")")"
Expand Down
2 changes: 1 addition & 1 deletion createdump-aspnet/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Enable "unofficial bash strict mode"
set -euo pipefail

IFS=$'\n\t'
set -x

IFS='.-' read -ra VERSION_SPLIT <<< "$1"
Expand Down
2 changes: 1 addition & 1 deletion distribution-packages/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

sdk_version="$(dotnet --version)"
Expand Down
2 changes: 1 addition & 1 deletion dotnet-info-commit-ids/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# unofficial bash strict mode
set -euo pipefail

IFS=$'\n\t'
set -x

dotnet --info
Expand Down
2 changes: 1 addition & 1 deletion dotnet-monitor-works/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

set -euo pipefail
set -x
IFS=$'\n\t'
set -x

IFS='.-' read -ra VERSION_SPLIT <<< "$1"
dotnet tool update -g dotnet-monitor --version "${VERSION_SPLIT[0]}.*-*"
Expand Down
1 change: 1 addition & 0 deletions dotnet-trace/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

PROJNAME=dotnettrace
Expand Down
1 change: 1 addition & 0 deletions extract-bundle-dir/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if [ -f /etc/profile ]; then
fi

set -euo pipefail
IFS=$'\n\t'

# Verify DOTNET_BUNDLE_EXTRACT_BASE_DIR is set.
if [[ "${DOTNET_BUNDLE_EXTRACT_BASE_DIR:-}" != "$HOME/.cache/dotnet_bundle_extract" ]]; then
Expand Down
4 changes: 3 additions & 1 deletion fdd-no-nuget/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

set +x
set -euo pipefail
IFS=$'\n\t'
set -x

rm -rf ~/.nuget

Expand Down
1 change: 1 addition & 0 deletions helloworld/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

PROJNAME=helloworld

Expand Down
1 change: 1 addition & 0 deletions host-probes-rid-assets-legacy/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euox pipefail
IFS=$'\n\t'

# This test is testing the same functionality as host-probes-rid-assets
# but when opting in to use the legacy graph (by setting System.Runtime.Loader.UseRidGraph=true).
Expand Down
1 change: 1 addition & 0 deletions host-probes-rid-assets/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euox pipefail
IFS=$'\n\t'

# The lib project packages a native library in a rid-specific folder.
# Only one rid is considered per nuget package.
Expand Down
1 change: 1 addition & 0 deletions liblttng-ust_sys-sdt.h/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

RUNTIME_ID=$(../runtime-id)
Expand Down
2 changes: 1 addition & 1 deletion libuv-kestrel-sample-app-2x/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

dotnet restore
Expand Down
1 change: 1 addition & 0 deletions lttng/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

SESSION_NAME=my-session
TEST_FOLDER=/tmp/$SESSION_NAME
Expand Down
1 change: 1 addition & 0 deletions man-pages/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

helpPages=$(dotnet --help | grep -A 999 'SDK commands' | grep -E -B 999 'Common options|Additional commands' | awk 'NR>1 {print $1}' | head -n-2)

Expand Down
2 changes: 1 addition & 1 deletion nativeaot/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

rm -rf bin obj
Expand Down
1 change: 0 additions & 1 deletion omnisharp/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -euo pipefail
IFS=$'\n\t'

set -x

rm -rf workdir
Expand Down
1 change: 1 addition & 0 deletions openssl-alpn/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Make sure .NET Core has linked to SSL_*_alpn_* functions from OpenSSL

set -euo pipefail
IFS=$'\n\t'
set -x

dotnet_dir="$(../dotnet-directory)"
Expand Down
2 changes: 1 addition & 1 deletion pgo-dynamic/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Check if the .NET Runtime can use dynamic PGO at runtime

set -euo pipefail

IFS=$'\n\t'
set -x

IFS='.-' read -ra VERSION <<< "$1"
Expand Down
1 change: 1 addition & 0 deletions publish-aspnet-selfcontained/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

# Clear nuget sources to use the bundled runtime.
Expand Down
1 change: 1 addition & 0 deletions publish-dotnet-selfcontained/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

# Clear nuget sources to use the bundled runtime.
Expand Down
1 change: 1 addition & 0 deletions publish-ready-to-run-linux/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

dotnet new console --no-restore
Expand Down
1 change: 1 addition & 0 deletions publish-ready-to-run/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

dotnet new console --no-restore
Expand Down
1 change: 1 addition & 0 deletions restore-with-rid/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

dotnet new console --no-restore
Expand Down
2 changes: 1 addition & 1 deletion system-data-odbc/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

set -euo pipefail

IFS=$'\n\t'
set -x

# This test *must* be run as non-root; postgresql will refuse to start as root.
Expand Down
2 changes: 1 addition & 1 deletion system-libunwind/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

framework_dir=$(../dotnet-directory --framework "$1")
Expand Down
1 change: 1 addition & 0 deletions system-openssl/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# using OpenSSL via dlopen (which is more likely to fail at runtime).

set -euo pipefail
IFS=$'\n\t'
set -x

dotnet_dir="$(../dotnet-directory)"
Expand Down
2 changes: 1 addition & 1 deletion targeting-packs-bad-files/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

dotnet_dir=$(dirname "$(readlink -f "$(command -v dotnet)")")
Expand Down
1 change: 1 addition & 0 deletions telemetry-is-off-by-default/test-telemetry-tcpdump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

set -euo pipefail
set -x
IFS=$'\n\t'

# found via experimentation
telemetry_host=dc.services.visualstudio.com
Expand Down
1 change: 1 addition & 0 deletions telemetry-is-off-by-default/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# access.

set -euo pipefail
IFS=$'\n\t'
set -x

no_server=("/nodeReuse:false" "/p:UseSharedCompilation=false" "/p:UseRazorBuildServer=false")
Expand Down
3 changes: 2 additions & 1 deletion template-test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# dotnet new <template>

set -euo pipefail
#set -x
IFS=$'\n\t'
set -x

# The list of templates in each version of .NET that we want to test.
# If additional templates are found via `dotnet new --list`, this test
Expand Down
1 change: 1 addition & 0 deletions tool-dev-certs/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fi
# Enable "unofficial strict mode" only after loading /etc/profile
# because that usually contains lots of "errors".
set -euo pipefail
IFS=$'\n\t'
set -x

IFS='.-' read -ra VERSION_SPLIT <<< "$1"
Expand Down
2 changes: 1 addition & 1 deletion use-current-runtime/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

PORTABLE_RID="$(../runtime-id --portable)"
Expand Down
2 changes: 1 addition & 1 deletion workload/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

IFS=$'\n\t'
set -x

# In some environments, such as Github Actions, /tmp/ is strange and
Expand Down
1 change: 1 addition & 0 deletions xunit-smoketest/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

for TEST_RESULT in pass fail ;
do
Expand Down

0 comments on commit 91d4b85

Please sign in to comment.