aboutsummaryrefslogtreecommitdiff
path: root/bazel/FuzzTargetTestWrapper.java
diff options
context:
space:
mode:
authorFabian Meumertzheim <fabian@meumertzhe.im>2021-10-25 11:53:08 +0200
committerFabian Meumertzheim <fabian@meumertzhe.im>2021-10-25 17:30:18 +0200
commit40e8ea4a4c45e78fe3cbc67618ca0673f3b781d8 (patch)
treeeeefe6d4a286a9ab3cadf6a5f6c49844b1bb849f /bazel/FuzzTargetTestWrapper.java
parent57bbcf4538a2f70a6e669dcb9c920672fb65134b (diff)
downloadjazzer-api-40e8ea4a4c45e78fe3cbc67618ca0673f3b781d8.tar.gz
Map rootpath to rlocation path in fuzz target test wrapper
Diffstat (limited to 'bazel/FuzzTargetTestWrapper.java')
-rw-r--r--bazel/FuzzTargetTestWrapper.java29
1 files changed, 11 insertions, 18 deletions
diff --git a/bazel/FuzzTargetTestWrapper.java b/bazel/FuzzTargetTestWrapper.java
index 286bb86c..59b15844 100644
--- a/bazel/FuzzTargetTestWrapper.java
+++ b/bazel/FuzzTargetTestWrapper.java
@@ -28,24 +28,8 @@ public class FuzzTargetTestWrapper {
Runfiles runfiles;
try {
runfiles = Runfiles.create();
- String driverRlocation;
- if (System.getProperty("os.name").startsWith("Windows")) {
- driverRlocation = args[0] + ".exe";
- } else {
- driverRlocation = args[0];
- }
- driverActualPath = runfiles.rlocation(driverRlocation);
- if (driverActualPath == null) {
- System.err.println("driverActualPath is null, driverRlocation=" + driverRlocation);
- System.exit(1);
- return;
- }
- jarActualPath = runfiles.rlocation(args[1]);
- if (jarActualPath == null) {
- System.err.println("jarActualPath is null, jarRlocation=" + jarActualPath);
- System.exit(1);
- return;
- }
+ driverActualPath = runfiles.rlocation(rlocationPath(args[0]));
+ jarActualPath = runfiles.rlocation(rlocationPath(args[1]));
} catch (IOException | ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
System.exit(1);
@@ -91,4 +75,13 @@ public class FuzzTargetTestWrapper {
}
System.exit(0);
}
+
+ // Turns the result of Bazel's `$(rootpath ...)` into the correct format for rlocation.
+ private static String rlocationPath(String rootpath) {
+ if (rootpath.startsWith("external/")) {
+ return rootpath.substring("external/".length());
+ } else {
+ return "jazzer/" + rootpath;
+ }
+ }
}