Skip to content

Commit

Permalink
Add a testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
cocreature committed Jul 30, 2020
1 parent d9062f9 commit e747a5b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,26 @@ scala_specs2_junit_test(
"//test:test_scala_proto_server",
]]

# Generate a file containing the rootpaths of a Scala binary.
genrule(
name = "rootpath-script",
outs = ["rootpath-script.out"],
cmd = """
rootpaths=($(rootpaths {}))
(IFS='\n'; echo "$${{rootpaths[*]}}") | sort > $@
""".format(":ScalaBinary"),
srcs = [":ScalaBinary"],
)

# Validate that the rootpaths point to both the binary
# and the JAR.
sh_test(
name = "ScalaBinaryRootpaths",
srcs = ["rootpaths_binary.sh"],
args = ["$(location :rootpath-script.out)"],
data = [":rootpath-script.out"],
)

sh_test(
name = "test_binary_run_with_large_classpath",
srcs = ["test_binary_run_with_large_classpath.sh"],
Expand Down
11 changes: 11 additions & 0 deletions test/rootpaths_binary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -eou pipefail

content="$(cat $1)"
expected=$'test/ScalaBinary\ntest/ScalaBinary.jar'
if [ "$content" != "$expected" ]; then
echo "Unexpected rootpaths: $content"
echo "$expected"
exit 1
fi

0 comments on commit e747a5b

Please sign in to comment.