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

Commit bd15d43

Browse files
committed
Make test.sh compatible with Gradle projects
Closes gh-878
1 parent e7f62ab commit bd15d43

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
${PWD%/*samples/*}/scripts/compileWithGradle.sh
3+
${PWD%/*samples/*}/scripts/compileWithGradle.sh && ${PWD%/*samples/*}/scripts/test.sh

samples/commandlinerunner-gradle/verify.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
if [[ `cat build/native-image/test-output.txt | grep "commandlinerunner running!"` ]]; then
2+
if [[ `cat build/native/test-output.txt | grep "commandlinerunner running!"` ]]; then
33
exit 0
44
else
55
exit 1

scripts/test.sh

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
# If supplied $1 is the executable and $2 is the file where to create test-output.txt and summary.csv, otherwise these
3-
# default to the 'target/current-directory-name' (e.g. target/commandlinerunner) and
4-
# target/native respectively
3+
# default to the 'target/current-directory-name' (e.g. target/commandlinerunner) and target/native respectively for Maven
4+
# or 'build/native/current-directory-name' (e.g. build/native/commandlinerunner) and build/native respectively for Gradle.
55

66
GREEN='\033[0;32m'
77
RED='\033[0;31m'
@@ -10,25 +10,33 @@ NC='\033[0m'
1010
if [[ "$1" == "-s" ]]; then
1111
SILENT=true
1212
shift 1
13-
else
13+
else
1414
SILENT=false
1515
fi
1616

17+
if [ -f pom.xml ]; then
18+
EXECUTABLE_DIR=target
19+
REPORT_DIR=target/native
20+
else
21+
EXECUTABLE_DIR=build/native
22+
REPORT_DIR=build/native
23+
fi
24+
1725
if ! [ -z "$1" ]; then
1826
if [[ "$1" != "--"* ]]; then
1927
EXECUTABLE=${1}
2028
shift 1
2129
else
22-
EXECUTABLE=target/${PWD##*/}
30+
EXECUTABLE=${EXECUTABLE_DIR}/${PWD##*/}
2331
fi
2432
else
25-
EXECUTABLE=${1:-target/${PWD##*/}}
33+
EXECUTABLE=${1:-${EXECUTABLE_DIR}/${PWD##*/}}
2634
fi
2735

2836
if [ -z "$1" ] || [[ "$1" == "--"* ]]; then
29-
TEST_OUTPUT_FILE=target/native/test-output.txt
30-
BUILD_OUTPUT_FILE=target/native/output.txt
31-
SUMMARY_CSV_FILE=target/native/summary.csv
37+
TEST_OUTPUT_FILE=${REPORT_DIR}/test-output.txt
38+
BUILD_OUTPUT_FILE=${REPORT_DIR}/output.txt
39+
SUMMARY_CSV_FILE=${REPORT_DIR}/summary.csv
3240
else
3341
TEST_OUTPUT_FILE=$1/test-output.txt
3442
BUILD_OUTPUT_FILE=$1/output.txt

0 commit comments

Comments
 (0)