diff options
author | 2015-09-10 21:46:04 +0000 | |
---|---|---|
committer | 2015-09-11 09:45:37 +0000 | |
commit | 757058c7c49e758acabfa9801a0e79ffe83652e2 (patch) | |
tree | ef2231eefb3c45cfc4df6fc782c241a325e0a77d /src/test | |
parent | 7ad99cb9061b8663235bffb4590ee0f9bd9c5820 (diff) |
Fix BUILD_SCM_* being looked for in the stable status file and test it.
They're actually in the volatile status file, which is where it seems
like they belong.
Fixes #216.
--
Change-Id: Ibec7737538ff5c1003b61d1bd3396948c61886de
Reviewed-on: https://bazel-review.googlesource.com/1950
MOS_MIGRATED_REVID=102791996
Diffstat (limited to 'src/test')
-rwxr-xr-x | src/test/shell/bazel/bazel_workspace_status_test.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/test/shell/bazel/bazel_workspace_status_test.sh b/src/test/shell/bazel/bazel_workspace_status_test.sh index 801b374f1b..1a56292cf2 100755 --- a/src/test/shell/bazel/bazel_workspace_status_test.sh +++ b/src/test/shell/bazel/bazel_workspace_status_test.sh @@ -70,4 +70,48 @@ EOF || fail "BUILD_SCM_STATUS not found" } +function test_workspace_status_cpp() { + create_new_workspace + + local cmd=$TEST_TMPDIR/status.sh + cat > $cmd <<EOF +#!/bin/bash + +echo BUILD_SCM_STATUS funky +EOF + chmod +x $cmd + + mkdir -p a + cat > a/linkstamped_library.cc <<'EOF' +#include <string> + +::std::string BuildScmStatus() { return BUILD_SCM_STATUS; } +EOF + cat > a/verify_scm_status.cc <<'EOF' +#include <string> +#include <iostream> + +::std::string BuildScmStatus(); + +int main() { + ::std::cout << "BUILD_SCM_STATUS is: " << BuildScmStatus(); + + return ("funky" == BuildScmStatus()) ? 0 : 1; +} +EOF + + cat > a/BUILD <<'EOF' +cc_library( + name="linkstamped_library", + linkstamp="linkstamped_library.cc") +cc_test( + name="verify_scm_status", + stamp=True, + srcs=["verify_scm_status.cc"], + deps=[":linkstamped_library"]) +EOF + + bazel test --stamp //a:verify_scm_status --workspace_status_command=$cmd || fail "build failed" +} + run_suite "workspace status tests" |