Skip to content

Commit

Permalink
deploy: Fix jazzer not being executable
Browse files Browse the repository at this point in the history
Since 4d0c74b, the Jazzer jar lacked a
`Main-Class` attribute.
  • Loading branch information
fmeum committed Aug 31, 2023
1 parent 1d66a46 commit 4b038bf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
8 changes: 8 additions & 0 deletions deploy/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
31 changes: 31 additions & 0 deletions deploy/jazzer_version_test.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion src/main/java/com/code_intelligence/jazzer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)

Expand Down

0 comments on commit 4b038bf

Please sign in to comment.