Lines Matching +full:- +full:- +full:exit +full:- +full:code
2 # Copyright 2023 Code Intelligence GmbH
8 # http://www.apache.org/licenses/LICENSE-2.0
16 # Development-only. This script builds the example project against the local version of Jazzer,
19 set -e
25 JAZZER_VERSION=$(grep -oP '(?<=JAZZER_VERSION = ")[^"]*' ../../maven.bzl)
26 # Find line with "<artifactId>jazzer-junit</artifactId>" and replace the version in the next line
27 sed -i "/<artifactId>jazzer-junit<\/artifactId>/ {n;s/<version>.*<\/version>/<version>$JAZZER_VERSI…
29 # Add locally-built Jazzer to the Maven repository
30 ./mvnw install:install-file -Dfile=../../bazel-bin/deploy/jazzer-junit-project.jar -DpomFile=../../…
31 ./mvnw install:install-file -Dfile=../../bazel-bin/deploy/jazzer-project.jar -DpomFile=../../…
32 ./mvnw install:install-file -Dfile=../../bazel-bin/deploy/jazzer-api-project.jar -DpomFile=../../…
35 echo "[SPRINGBOOT-JUNIT]: These unit and regression fuzz tests should pass"
36 ./mvnw test -Dtest="JunitSpringWebApplicationTests#unitTestShouldPass+fuzzTestShouldPass"
38 echo "[SPRINGBOOT-JUNIT]: This regression fuzz test should fail."
39 # Temporarily disable exit on error.
41 ./mvnw test -Dtest="JunitSpringWebApplicationTests#fuzzTestShouldFail"
42 declare -i exit_code=$?
43 set -e
45 # Assert that the test failed with exit code 1.
46 if [ $exit_code -eq 1 ]
48 echo "[SPRINGBOOT-JUNIT]: Expected failing fuzz tests: continuing"
50 echo "[SPRINGBOOT-JUNIT]: Expected exit code 1, but got $exit_code"
51 exit 1
55 echo "[SPRINGBOOT-JUNIT]: This fuzz test should pass"
56 JAZZER_FUZZ=1 ./mvnw test -Dtest="JunitSpringWebApplicationTests#fuzzTestShouldPass"
58 echo "[SPRINGBOOT-JUNIT]: This fuzz test should fail"
60 JAZZER_FUZZ=1 ./mvnw test -Dtest="JunitSpringWebApplicationTests#fuzzTestShouldFail"
61 declare -i exit_code=$?
62 set -e
64 if [ $exit_code -eq 1 ]
66 echo "[SPRINGBOOT-JUNIT]: Expected failing fuzz tests: continuing"
68 echo "[SPRINGBOOT-JUNIT]: Expected exit code 1, but got $exit_code"
69 exit 1
72 echo "[SPRINGBOOT-JUNIT]: This fuzz test using autofuzz should fail"
74 JAZZER_FUZZ=1 ./mvnw test -Dtest="JunitSpringWebApplicationTests#fuzzTestWithDtoShouldFail"
75 declare -i exit_code=$?
76 set -e
78 if [ $exit_code -eq 1 ]
80 echo "[SPRINGBOOT-JUNIT]: Expected failing fuzz tests: continuing"
82 echo "[SPRINGBOOT-JUNIT]: Expected exit code 1, but got $exit_code"
83 exit 1
89 if ./mvnw dependency:tree | grep -q "$1"
91 echo "[SPRINGBOOT-JUNIT]: Found $1 dependency in project"
93 echo "[SPRINGBOOT-JUNIT]: Did not find $1 dependency in project"
94 exit 1
97 assertDependency "org.junit.jupiter:junit-jupiter-api"
98 assertDependency "org.junit.jupiter:junit-jupiter-params"
99 assertDependency "org.junit.platform:junit-platform-launcher"
101 # Only build project and test jars, no need for a fat-jar or test execution
103 ./mvnw jar:test-jar
106 out=$(./mvnw dependency:build-classpath -DforceStdout)
110 echo "[SPRINGBOOT-JUNIT]: Direct Jazzer execution of fuzz test should pass"
111 java -cp "target/*:${deps}" \
113 --target_class=com.example.JunitSpringWebApplicationTests \
114 --target_method=fuzzTestShouldPass \
115 --instrumentation_includes=com.example.* \
116 --custom_hook_includes=com.example.*
119 echo "[SPRINGBOOT-JUNIT]: Direct Jazzer execution of fuzz test using autofuzz should fail"
121 JAZZER_FUZZ=1 java -cp "target/*:${deps}" \
123 --target_class=com.example.JunitSpringWebApplicationTests \
124 --target_method=fuzzTestWithDtoShouldFail \
125 --instrumentation_includes=com.example.* \
126 --custom_hook_includes=com.example.*
127 declare -i exit_code=$?
128 set -e
130 if [ $exit_code -eq 77 ]
132 echo "[SPRINGBOOT-JUNIT]: Expected failing fuzz tests: continuing"
134 echo "[SPRINGBOOT-JUNIT]: Expected exit code 77, but got $exit_code"
135 exit 1
138 echo "[SPRINGBOOT-JUNIT]: All tests passed"