diff --git a/deploy/BUILD.bazel b/deploy/BUILD.bazel index c6d3bbc08..f84836c5f 100644 --- a/deploy/BUILD.bazel +++ b/deploy/BUILD.bazel @@ -90,6 +90,14 @@ java_export( ], ) +sh_test( + name = "jazzer_version_test", + srcs = ["jazzer_version_test.sh"], + args = ["$(rlocationpath :jazzer)"], + data = [":jazzer"], + deps = ["@bazel_tools//tools/bash/runfiles"], +) + [ sh_test( name = artifact + "_artifact_test", diff --git a/deploy/jazzer_version_test.sh b/deploy/jazzer_version_test.sh new file mode 100755 index 000000000..24826618d --- /dev/null +++ b/deploy/jazzer_version_test.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Copyright 2023 Code Intelligence GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# --- begin runfiles.bash initialization v3 --- +# Copy-pasted from the Bazel Bash runfiles library v3. +set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash +source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e +# --- end runfiles.bash initialization v3 --- + +jazzer=$(rlocation "$1") +[ -f "$jazzer" ] || exit 1 +jazzer_version_output=$("$jazzer" --version 2>&1) +echo "$jazzer_version_output" +echo "$jazzer_version_output" | tr -d '\n' | grep -q '^Jazzer v[0-9.]*$' || exit 1 diff --git a/src/main/java/com/code_intelligence/jazzer/BUILD.bazel b/src/main/java/com/code_intelligence/jazzer/BUILD.bazel index f000fa309..a5b73bf45 100644 --- a/src/main/java/com/code_intelligence/jazzer/BUILD.bazel +++ b/src/main/java/com/code_intelligence/jazzer/BUILD.bazel @@ -63,7 +63,9 @@ java_binary( "//src/main/java/com/code_intelligence/jazzer/api:api_deploy_env", "//src/main/java/com/code_intelligence/jazzer/runtime:jazzer_bootstrap_env", ], - main_class = "com.code_intelligence.jazzer.Jazzer", + deploy_manifest_lines = [ + "Main-Class: com.code_intelligence.jazzer.Jazzer", + ], runtime_deps = [":jazzer_lib"], )