summaryrefslogtreecommitdiff
path: root/BUILD.bazel
diff options
context:
space:
mode:
authorRin Kuryloski <kuryloskip@vmware.com>2022-12-19 13:49:07 +0100
committerRin Kuryloski <kuryloskip@vmware.com>2022-12-19 13:49:07 +0100
commit3db02f7f9fb3f1ac3c0ba70c0484f17e813ba2bf (patch)
tree03c1b20ccd67d553db3c0a4c80df23ef75d6cb0d /BUILD.bazel
parente799daa24e1b0fe2cc32f7700ba3edc0c71948eb (diff)
downloadrabbitmq-server-git-3db02f7f9fb3f1ac3c0ba70c0484f17e813ba2bf.tar.gz
Update `//:test-logs` and `//:test-node-data`
to handle the new ct_logdir flag
Diffstat (limited to 'BUILD.bazel')
-rw-r--r--BUILD.bazel150
1 files changed, 8 insertions, 142 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
index b5c63cc9de..e5935e5296 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -166,156 +166,22 @@ source_archive(
rabbitmq_workspace = "@",
)
-genrule(
+alias(
name = "test-logs",
- outs = ["open-test-logs.sh"],
- cmd = """set -euo pipefail
-cat << 'EOF' > $@
-#!/bin/bash
-set -euo pipefail
-if [ $$# -eq 0 ]; then
- echo "Usage: bazel run test-logs TEST_LABEL [shard_index]"
- exit 1
-fi
-
-RELATIVE=$${1#//}
-PACKAGE=$${RELATIVE%%:*}
-SUITE=$${RELATIVE##*:}
-OUTPUT_DIR=test.outputs
-
-if [ $$# -gt 1 ]; then
- OUTPUT_DIR=shard_$$2_of_*/test.outputs
-fi
-
-if [ ! -d "bazel-testlogs/$$PACKAGE/$$SUITE/"$$OUTPUT_DIR ]; then
- echo "Test output dir not found, perhaps shard_index needed?"
- echo "Usage: bazel run test-logs TEST_LABEL [shard_index]"
- exit 1
-fi
-
-cd "bazel-testlogs/$$PACKAGE/$$SUITE/"$$OUTPUT_DIR
-if [ -f outputs.zip ]; then
- unzip -u outputs.zip
-fi
-set +e
-open index.html
-rc=$$?
-set -e
-if [[ $$rc -eq 3 ]]; then
- # For xdg-open exit code 3 means "A required tool could not be found." That is, there is no browser.
- echo "Open your browser at http://$$(hostname -s):8000/index.html"
- python -m http.server 8000
-fi
-EOF
-""",
- executable = True,
+ actual = "//bazel/util:test-logs",
)
-genrule(
+alias(
name = "remote-test-logs",
- outs = ["open-remote-test-logs.sh"],
- cmd = """set -euo pipefail
-cat << 'EOF' > $@
-#!/bin/bash
-set -euo pipefail
-if [ $$# -eq 0 ]; then
- echo "Usage: bazel run remote-test-logs TEST_LABEL [shard_index]"
- exit 1
-fi
-
-RELATIVE=$${1#//}
-PACKAGE=$${RELATIVE%%:*}
-SUITE=$${RELATIVE##*:}
-OUTPUT_DIR=test.outputs
-if [ $$# -gt 1 ]; then
- OUTPUT_DIR=shard_$$2_of_*/test.outputs
-fi
-
-TESTLOGS=$$(echo $$(bazel info output_path)/k8-*/testlogs)
-
-if [ ! -d "$$TESTLOGS/$$PACKAGE/$$SUITE/$$OUTPUT_DIR" ]; then
- echo "Test output dir not found, perhaps shard_index needed?"
- echo "Usage: bazel run remote-test-logs TEST_LABEL [shard_index]"
- exit 1
-fi
-
-cd "$$TESTLOGS/$$PACKAGE/$$SUITE/$$OUTPUT_DIR" && unzip -u outputs.zip
-open index.html
-EOF
-""",
- executable = True,
+ actual = "//bazel/util:remote-test-logs",
)
-genrule(
+alias(
name = "test-node-data",
- outs = ["open-test-node-data.sh"],
- cmd = """set -euo pipefail
-cat << 'EOF' > $@
- set -euo pipefail
- if [ $$# -eq 0 ]; then
- echo "Usage: bazel run test-node-data TEST_LABEL [shard_index]"
- exit 1
- fi
-
- RELATIVE=$${1#//}
- PACKAGE=$${RELATIVE%%:*}
- SUITE=$${RELATIVE##*:}
- OUTPUT_DIR=test.outputs
- if [ $$# -gt 1 ]; then
- OUTPUT_DIR=shard_$$2_of_*/test.outputs
- fi
-
- if [ ! -d "bazel-testlogs/$$PACKAGE/$$SUITE/"$$OUTPUT_DIR ]; then
- echo "Test output dir not found, perhaps shard_index needed?"
- echo "Usage: bazel run test-node-data TEST_LABEL [shard_index]"
- exit 1
- fi
-
- cd bazel-testlogs/$$PACKAGE/$$SUITE/$$OUTPUT_DIR
- if [ -f outputs.zip ]; then
- unzip -u outputs.zip
- fi
- open index.html
- open ct_run.*/deps.*/run.*/log_private
-EOF
-""",
- executable = True,
+ actual = "//bazel/util:test-node-data",
)
-# NOTE: this rule may not work properly if --remote_download_minimal has been used,
-# which is currently the default for remote runs
-genrule(
+alias(
name = "remote-test-node-data",
- outs = ["open-remote-test-node-data.sh"],
- cmd = """set -euo pipefail
-cat << 'EOF' > $@
- set -euo pipefail
- if [ $$# -eq 0 ]; then
- echo "Usage: bazel run remote-test-node-data TEST_LABEL [shard_index]"
- exit 1
- fi
-
- RELATIVE=$${1#//}
- PACKAGE=$${RELATIVE%%:*}
- SUITE=$${RELATIVE##*:}
- OUTPUT_DIR=test.outputs
-
- if [ $$# -gt 1 ]; then
- OUTPUT_DIR=shard_$$2_of_*/test.outputs
- fi
-
- TESTLOGS=$$(echo $$(bazel info output_path)/k8-*/testlogs)
-
- if [ ! -d $$TESTLOGS/$$PACKAGE/$$SUITE/$$OUTPUT_DIR ]; then
- echo "Test output dir not found, perhaps shard_index needed?"
- echo "Usage: bazel run remote-test-node-data TEST_LABEL [shard_index]"
- exit 1
- fi
-
- cd $$TESTLOGS/$$PACKAGE/$$SUITE/$$OUTPUT_DIR && unzip -u outputs.zip
- open index.html
- open ct_run.*/deps.*/run.*/log_private
-EOF
-""",
- executable = True,
+ actual = "//bazel/util:remote-test-node-data",
)