Skip to content

Commit 37e768f

Browse files
authored
Correcting and/or exempting linter shellcheck code warnings (#4254)
* Correcting and/or exempting linter shellcheck code warnings Signed-off-by: Adam Farley <[email protected]> * Excluding solaris sbin scripts from build pipeline PR checks ...because we don't run builds on solaris as part of said checks, so it's a waste of machine time. Signed-off-by: Adam Farley <[email protected]> * Adding whitespace Signed-off-by: Adam Farley <[email protected]> * Amending grep piping chain Signed-off-by: Adam Farley <[email protected]> * Swapping for loop with equivalent that passes the linter Signed-off-by: Adam Farley <[email protected]> * Adding quotes to prevent splitting Signed-off-by: Adam Farley <[email protected]> * Adding quotes and removing problematic piping Signed-off-by: Adam Farley <[email protected]> * Amending double quotes to enable looping on the wildcard matches Signed-off-by: Adam Farley <[email protected]> * Removing ! -z to appease linter Signed-off-by: Adam Farley <[email protected]> * Removing excess whitespace Signed-off-by: Adam Farley <[email protected]> * Linter fixes Signed-off-by: Adam Farley <[email protected]> * Removing superfluous cat command Signed-off-by: Adam Farley <[email protected]> --------- Signed-off-by: Adam Farley <[email protected]>
1 parent 839fa0b commit 37e768f

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ on:
2222
- "sbin/**"
2323
- "**.sh"
2424
- "!tooling/**"
25+
- "!sbin/solaris/**"
2526
- ".github/workflows/build.yml"
2627
- "security/**"
2728
- "cyclonedx-lib/**"

sbin/solaris/dotests.sh

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
# shellcheck disable=SC2155,SC2153,SC2038,SC1091,SC2116,SC2086
2+
# shellcheck disable=SC2155,SC2153,SC2038,SC1091,SC2116,SC2086,SC2006
33
# ********************************************************************************
44
# Copyright (c) 2017, 2024 Contributors to the Eclipse Foundation
55
#
@@ -12,7 +12,6 @@
1212
#
1313
# SPDX-License-Identifier: Apache-2.0
1414
# ********************************************************************************
15-
# shellcheck disable=SC2006
1615
#
1716
# dotests.sh
1817
# Designed for running via a proxy machine for the Temurin Solaris tests
@@ -24,15 +23,15 @@
2423
# ./dotests.sh sanity openjdk
2524
#
2625

27-
if [ `uname -m` = i86pc ]; then ADOPTARCH=x64; else ADOPTARCH=sparcv9; fi
2826
# Check for Xvfb on display :5
29-
XVFB5=`ps -fu vagrant | grep 'Xvfb :5' | grep -v grep | wc -l`
30-
echo XVFB5 = $XVFB5
27+
XVFB5=`ps -fu vagrant | awk '/Xvfb :5/ && !/awk/ {c=c+1} END {print c+0}'`
28+
echo "XVFB5 = $XVFB5"
29+
3130
if [ $XVFB5 != 1 ]; then
3231
echo WARNING: Xvfb was not started - attempting to start ...
3332
nohup /usr/X11/bin/Xvfb :5 -screen 0 1024x768x24 &
3433
sleep 2
35-
XVFB5=`ps -fu vagrant | grep 'Xvfb :5' | grep -v grep | wc -l`
34+
XVFB5=`ps -fu vagrant | awk '/Xvfb :5/ && !/awk/ {c=c+1} END {print c+0}'`
3635
echo XVFB5 = $XVFB5
3736
[ $XVFB5 != 1 ] && echo Still failed to start Xvfb - manual intervention required && exit 1
3837
fi
@@ -50,41 +49,48 @@ else
5049
echo "ERROR: dotests.sh : UPSTREAM_JOBLINK not defined and build_artifacts/filenames.txt does not exist" - cannot progress
5150
exit 1
5251
fi
53-
JDK_TARBALL_NAME=`pwd`/build_artifacts/`cat build_artifacts/filenames.txt | grep "OpenJDK8U-jdk_.*tar.gz$"`
52+
JDK_TARBALL_NAME=`pwd`/build_artifacts/`grep "OpenJDK8U-jdk_.*tar.gz$" ./build_artifacts/filenames.txt`
5453
else
5554
# Linter can go do one if it objects to the backticks - "$(" is not understood by Solaris' bourne shell (SC2006)
5655
JDK_TARBALL_NAME=`curl -s "${UPSTREAM_JOBLINK}/artifact/workspace/target/filenames.txt" | grep "OpenJDK8U-jdk_.*tar.gz$"`
5756
[ -z "$JDK_TARBALL_NAME" ] && echo "Could not retrieve filenames.txt from $UPSTREAM_JOBLINK" && exit 1
5857
echo Downloading and extracting JDK tarball ...
5958
curl -O "${UPSTREAM_JOBLINK}/artifact/workspace/target/$JDK_TARBALL_NAME" || exit 1
6059
fi
61-
cd aqa-tests
60+
cd aqa-tests || exit 1
6261
gzip -cd "$JDK_TARBALL_NAME" | tar xpf -
6362
echo Downloading and extracting JRE tarball ... Required for special.openjdk jdk_math_jre_0 target
6463
JRE_TARBALL_NAME="`echo $JDK_TARBALL_NAME | sed s/jdk/jre/`"
65-
if [ "$1" = "special" -a "$2" = "openjdk" ]; then
66-
if [ ! -z "${UPSTREAM_JOBLINK}" ]; then
67-
curl -O "${UPSTREAM_JOBLINK}/artifact/workspace/target/$JRE_TARBALL_NAME" || exit 1
64+
if [ "$1" = "special" ]; then
65+
if [ "$2" = "openjdk" ]; then
66+
if [ "${UPSTREAM_JOBLINK}" != "" ]; then
67+
curl -O "${UPSTREAM_JOBLINK}/artifact/workspace/target/$JRE_TARBALL_NAME" || exit 1
68+
fi
69+
gzip -cd "$JRE_TARBALL_NAME" | tar xpf -
6870
fi
69-
gzip -cd "$JRE_TARBALL_NAME" | tar xpf -
7071
fi
7172
fi
7273
PWD=`pwd`
73-
TEST_JDK_HOME=`ls -1d $PWD/jdk8u* | grep -v jre`
74-
JRE_IMAGE=`ls -1d $PWD/jdk8u* | grep jre`
74+
TEST_JDK_HOME=""
75+
JRE_IMAGE=""
76+
for FILE in "$PWD"/jdk8u*; do
77+
[ "`echo "$FILE" | grep -v jre`" ] && TEST_JDK_HOME="$FILE"
78+
[ "`echo "$FILE" | grep jre`" ] && JRE_IMAGE="$FILE"
79+
done
7580
env
7681
# TODO: Check if this actually exists
77-
[ -z "$TEST_JDK_HOME" ] && echo Could not resolve TEST_JDK_HOME - aborting && exit 1
82+
[ -z "$TEST_JDK_HOME" ] && echo "Could not resolve TEST_JDK_HOME - aborting" && exit 1
7883
echo TEST_JDK_HOME=$TEST_JDK_HOME
7984
"$TEST_JDK_HOME/bin/java" -version || exit 1
8085
BUILD_LIST=$2
8186
if [ "$BUILD_LIST" = "system" ]; then
82-
mkdir -p `pwd`/systemtest_prereqs/mauve # systemtest_preqeqs not created til compile phase
83-
curl -o `pwd`/systemtest_prereqs/mauve/mauve.jar \
87+
mkdir -p "`pwd`/systemtest_prereqs/mauve" # systemtest_preqeqs not created til compile phase
88+
curl -o "`pwd`/systemtest_prereqs/mauve/mauve.jar" \
8489
https://ci.adoptium.net/job/systemtest.getDependency/lastSuccessfulBuild/artifact/systemtest_prereqs/mauve/mauve.jar
8590
fi
8691
GET_SH_PARAMS=""
8792
if [ "$1" = "smoke" ]; then
93+
# shellcheck disable=SC2121
8894
set extended functional
8995
GET_SH_PARAMS="--vendor_repos https://github.com/adoptium/temurin-build --vendor_branches master --vendor_dirs /test/functional"
9096
BUILD_LIST=functional/buildAndPackage
@@ -93,9 +99,9 @@ fi
9399
PATH=/usr/local/bin:/opt/csw/bin:`echo $PATH | sed 's,/usr/xpg4/bin,,g'`
94100
export TEST_JDK_HOME BUILD_LIST PATH JRE_IMAGE
95101
[ "$3" != "usecache" ] && ./get.sh ${GET_SH_PARAMS}
96-
cd TKG
102+
cd TKG || exit 1
97103
(echo VENDOR OPTIONS = $VENDOR_TEST_REPOS / $VENDOR_TEST_DIRS / $VENDOR_TEST_BRANCHES)
98104
gmake compile
99-
echo SXAEC: Running gmake _$1.$2 from `pwd`
105+
echo SXAEC: Running gmake _$1.$2 from "`pwd`"
100106
DISPLAY=:5; export DISPLAY
101107
gmake _$1.$2 2>&1 | tee $1.$2.$$.log

tooling/reproducible/repro_compare.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ echo "$(date +%T) : diff complete - rc=$rc. Output written to file: ${output}"
8383

8484
cat "${output}"
8585

86+
# Restricting detailed output to classlist files only.
87+
# This is because grepping every file overloads the test
88+
# job with too much output, but the class list contents
89+
# are especially useful when debugging a failure.
8690
grep "Files .*/classlist" "${output}" | while read -r line; do
8791
FILE1=$(echo "$line" | awk '{print $2}')
8892
FILE2=$(echo "$line" | awk '{print $4}')

0 commit comments

Comments
 (0)