diff options
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/bazel/bazel_example_test.sh | 17 | ||||
-rwxr-xr-x | src/test/shell/bazel/bazel_rules_test.sh | 6 | ||||
-rwxr-xr-x | src/test/shell/bazel/bazel_sandboxing_test.sh | 2 | ||||
-rwxr-xr-x | src/test/shell/bazel/external_integration_test.sh | 12 | ||||
-rwxr-xr-x | src/test/shell/bazel/generate_workspace_test.sh | 2 | ||||
-rwxr-xr-x | src/test/shell/bazel/git_repository_test.sh | 8 | ||||
-rwxr-xr-x | src/test/shell/bazel/local_repository_test.sh | 2 | ||||
-rwxr-xr-x | src/test/shell/bazel/runfiles_test.sh | 39 | ||||
-rwxr-xr-x | src/test/shell/bazel/testenv.sh | 3 | ||||
-rwxr-xr-x | src/test/shell/integration/runfiles_test.sh | 7 |
10 files changed, 36 insertions, 62 deletions
diff --git a/src/test/shell/bazel/bazel_example_test.sh b/src/test/shell/bazel/bazel_example_test.sh index 93075fddb6..b9d2aef276 100755 --- a/src/test/shell/bazel/bazel_example_test.sh +++ b/src/test/shell/bazel/bazel_example_test.sh @@ -23,9 +23,6 @@ source $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/test-setup.sh \ function set_up() { copy_examples - cat > WORKSPACE <<EOF -workspace(name = "io_bazel") -EOF } # @@ -80,6 +77,20 @@ function test_java_test_with_junitrunner() { assert_test_ok "${java_native_tests}:custom_with_test_class" } +function test_java_test_with_workspace_name() { + local java_pkg=examples/java-native/src/main/java/com/example/myproject + # Use named workspace and test if we can still execute hello-world + bazel clean + + rm -f WORKSPACE + cat >WORKSPACE <<'EOF' +workspace(name = "toto") +EOF + + assert_build_output ./bazel-bin/${java_pkg}/hello-world ${java_pkg}:hello-world + assert_binary_run_from_subdir "bazel-bin/${java_pkg}/hello-world foo" "Hello foo" +} + function test_genrule_and_genquery() { # The --javabase flag is to force the tools/jdk:jdk label to be used # so it appears in the dependency list. diff --git a/src/test/shell/bazel/bazel_rules_test.sh b/src/test/shell/bazel/bazel_rules_test.sh index c82b9cd996..b0f7e4e312 100755 --- a/src/test/shell/bazel/bazel_rules_test.sh +++ b/src/test/shell/bazel/bazel_rules_test.sh @@ -63,7 +63,7 @@ function test_extra_action() { # a program that parses the proto here. cat > mypkg/echoer.sh <<EOF #!/bin/bash -if [[ ! -e \$0.runfiles/__main__/mypkg/runfile ]]; then +if [[ ! -e \$0.runfiles/mypkg/runfile ]]; then echo "Runfile not found" >&2 exit 1 fi @@ -357,8 +357,8 @@ def Fib(n): EOF cat > module2/bez.py <<EOF -from remote.module_a import foo -from remote.module_b import bar +from external.remote.module_a import foo +from external.remote.module_b import bar from module1 import fib print "The number is %d" % foo.GetNumber() diff --git a/src/test/shell/bazel/bazel_sandboxing_test.sh b/src/test/shell/bazel/bazel_sandboxing_test.sh index 9e6bc857d8..27097bc9c1 100755 --- a/src/test/shell/bazel/bazel_sandboxing_test.sh +++ b/src/test/shell/bazel/bazel_sandboxing_test.sh @@ -164,7 +164,7 @@ EOF #!/bin/sh set -e -cp $(dirname $0)/tool.runfiles/__main__/examples/genrule/datafile $1 +cp $(dirname $0)/tool.runfiles/examples/genrule/datafile $1 echo "Tools work!" EOF chmod +x examples/genrule/tool.sh diff --git a/src/test/shell/bazel/external_integration_test.sh b/src/test/shell/bazel/external_integration_test.sh index e9c1bc6660..6f3a6b03c0 100755 --- a/src/test/shell/bazel/external_integration_test.sh +++ b/src/test/shell/bazel/external_integration_test.sh @@ -139,7 +139,7 @@ EOF cat > zoo/female.sh <<EOF #!/bin/bash -../endangered/fox/male +./external/endangered/fox/male EOF chmod +x zoo/female.sh fi @@ -422,10 +422,10 @@ EOF cat > test/test.sh <<EOF #!/bin/bash echo "symlink:" -ls -l ../toto/file +ls -l external/toto/file echo "dest:" -ls -l \$(readlink -f ../toto/file/toto) -../toto/file/toto +ls -l \$(readlink -f external/toto/file/toto) +external/toto/file/toto EOF chmod +x test/test.sh @@ -459,7 +459,7 @@ EOF cat > test/test.sh <<EOF #!/bin/bash -cat ../toto/file/toto +cat external/toto/file/toto EOF chmod +x test/test.sh @@ -581,7 +581,7 @@ EOF cat > zoo/female.sh <<EOF #!/bin/bash -cat ../endangered/fox/male +cat external/endangered/fox/male EOF chmod +x zoo/female.sh diff --git a/src/test/shell/bazel/generate_workspace_test.sh b/src/test/shell/bazel/generate_workspace_test.sh index 584f3e04d8..18168459c9 100755 --- a/src/test/shell/bazel/generate_workspace_test.sh +++ b/src/test/shell/bazel/generate_workspace_test.sh @@ -24,6 +24,8 @@ source $src_dir/test-setup.sh \ source $src_dir/remote_helpers.sh \ || { echo "remote_helpers.sh not found!" >&2; exit 1; } +export JAVA_RUNFILES=$TEST_SRCDIR + function set_up() { # Set up custom repository directory. m2=$TEST_TMPDIR/my-m2 diff --git a/src/test/shell/bazel/git_repository_test.sh b/src/test/shell/bazel/git_repository_test.sh index 2c862b7f7e..67a630dd1b 100755 --- a/src/test/shell/bazel/git_repository_test.sh +++ b/src/test/shell/bazel/git_repository_test.sh @@ -85,7 +85,7 @@ EOF cat > planets/planet_info.sh <<EOF #!/bin/bash -cat ../pluto/info +cat external/pluto/info EOF chmod +x planets/planet_info.sh @@ -171,7 +171,7 @@ EOF cat > planets/planet_info.sh <<EOF #!/bin/bash -cat ../pluto/info +cat external/pluto/info EOF chmod +x planets/planet_info.sh @@ -246,8 +246,8 @@ EOF cat > planets/planet_info.sh <<EOF #!/bin/bash -cat ../outer_planets/neptune/info -cat ../outer_planets/pluto/info +cat external/outer_planets/neptune/info +cat external/outer_planets/pluto/info EOF chmod +x planets/planet_info.sh diff --git a/src/test/shell/bazel/local_repository_test.sh b/src/test/shell/bazel/local_repository_test.sh index d078cadba3..d2ba764726 100755 --- a/src/test/shell/bazel/local_repository_test.sh +++ b/src/test/shell/bazel/local_repository_test.sh @@ -95,7 +95,7 @@ EOF cat > zoo/dumper.sh <<EOF #!/bin/bash -cat ../pandas/red/baby-panda +cat external/pandas/red/baby-panda cat red/day-keeper EOF chmod +x zoo/dumper.sh diff --git a/src/test/shell/bazel/runfiles_test.sh b/src/test/shell/bazel/runfiles_test.sh index 698f319d59..33205b86d2 100755 --- a/src/test/shell/bazel/runfiles_test.sh +++ b/src/test/shell/bazel/runfiles_test.sh @@ -53,43 +53,4 @@ EOF [[ -x bazel-bin/foo/foo.runfiles/$name/foo/foo ]] || fail "No foo executable under $name" } -function test_external_runfiles() { - cat > WORKSPACE <<EOF -workspace(name = "foo") - -new_local_repository( - name = "bar", - path = ".", - build_file = "BUILD", -) -EOF - - cat > BUILD <<EOF -exports_files(glob(["*"])) - -cc_binary( - name = "thing", - srcs = ["thing.cc"], - data = ["@bar//:thing.cc"], -) -EOF - cat > thing.cc <<EOF -int main() { return 0; } -EOF - bazel build --legacy_external_runfiles //:thing &> $TEST_log \ - || fail "Build failed" - [[ -d bazel-bin/thing.runfiles/foo/external/bar ]] \ - || fail "bar not found" - - bazel build --nolegacy_external_runfiles //:thing &> $TEST_log \ - || fail "Build failed" - [[ ! -d bazel-bin/thing.runfiles/foo/external/bar ]] \ - || fail "Old bar still found" - - bazel build --legacy_external_runfiles //:thing &> $TEST_log \ - || fail "Build failed" - [[ -d bazel-bin/thing.runfiles/foo/external/bar ]] \ - || fail "bar not recreated" -} - run_suite "runfiles tests" diff --git a/src/test/shell/bazel/testenv.sh b/src/test/shell/bazel/testenv.sh index 4db59d358e..5689de846e 100755 --- a/src/test/shell/bazel/testenv.sh +++ b/src/test/shell/bazel/testenv.sh @@ -18,7 +18,6 @@ # [ -z "$TEST_SRCDIR" ] && { echo "TEST_SRCDIR not set!" >&2; exit 1; } -TEST_SRCDIR="$TEST_SRCDIR/io_bazel" # Load the unit-testing framework source "${TEST_SRCDIR}/src/test/shell/unittest.bash" || \ @@ -30,7 +29,7 @@ bazel="${TEST_SRCDIR}/src/bazel" bazel_data="${TEST_SRCDIR}" # Java -jdk_dir="${TEST_SRCDIR}/../local_jdk" +jdk_dir="${TEST_SRCDIR}/external/local_jdk" langtools="${TEST_SRCDIR}/src/test/shell/bazel/langtools.jar" # Tools directory location diff --git a/src/test/shell/integration/runfiles_test.sh b/src/test/shell/integration/runfiles_test.sh index ee26ca130c..6821b30dcd 100755 --- a/src/test/shell/integration/runfiles_test.sh +++ b/src/test/shell/integration/runfiles_test.sh @@ -55,16 +55,16 @@ EOF bazel build pkg:py >&$TEST_log 2>&1 || fail "build failed" # we get a warning that hidden.py is inaccessible - expect_log_once "/genfiles/pkg/e/f/g/hidden.py obscured by .*/pkg/e/f " + expect_log_once "/genfiles/pkg/e/f/g/hidden.py obscured by pkg/e/f " } function test_foo_runfiles() { - cat > BUILD << EOF +cat > BUILD << EOF py_library(name = "root", srcs = ["__init__.py"], visibility = ["//visibility:public"]) EOF - cat > pkg/BUILD << EOF +cat > pkg/BUILD << EOF sh_binary(name = "foo", srcs = [ "x/y/z.sh" ], data = [ ":py", @@ -149,3 +149,4 @@ EOF } run_suite "runfiles" + |