Skip to content

Commit

Permalink
Fix a bug when a relative path is used for the execution log
Browse files Browse the repository at this point in the history
Fixes bazelbuild#8364

RELNOTES: None
PiperOrigin-RevId: 248786565
  • Loading branch information
Googler authored and copybara-github committed May 17, 2019
1 parent d5b163e commit dd9ac13
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void initOutputs(CommandEnvironment env) throws IOException {

AsynchronousFileOutputStream outStream = null;
if (executionOptions.executionLogFile != null) {
rawOutput = env.getRuntime().getFileSystem().getPath(executionOptions.executionLogFile);
rawOutput = workingDirectory.getRelative(executionOptions.executionLogFile);
outStream =
new AsynchronousFileOutputStream(
workingDirectory.getRelative(executionOptions.executionLogFile));
Expand Down
12 changes: 12 additions & 0 deletions src/test/shell/bazel/bazel_execlog_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,16 @@ EOF
fi
}

function test_dir_relative() {
cat > BUILD <<'EOF'
genrule(
name = "rule",
outs = ["out.txt"],
cmd = "echo hello > $(location out.txt)"
)
EOF
bazel build //:all --experimental_execution_log_file output 2>&1 >> $TEST_log || fail "could not build"
wc output || fail "no output produced"
}

run_suite "execlog_tests"

0 comments on commit dd9ac13

Please sign in to comment.