diff --git a/rules/diff_test.bzl b/rules/diff_test.bzl index 6fb3581..4482e6c 100644 --- a/rules/diff_test.bzl +++ b/rules/diff_test.bzl @@ -86,6 +86,9 @@ if [[ -d "${{RUNFILES_DIR:-/dev/null}}" && "${{RUNFILES_MANIFEST_ONLY:-}}" != 1 elif [[ -f "${{RUNFILES_MANIFEST_FILE:-/dev/null}}" ]]; then RF1="$(grep -F -m1 "$F1 " "$RUNFILES_MANIFEST_FILE" | sed 's/^[^ ]* //')" RF2="$(grep -F -m1 "$F2 " "$RUNFILES_MANIFEST_FILE" | sed 's/^[^ ]* //')" +elif [[ -f "$TEST_SRCDIR/$F1" && -f "$TEST_SRCDIR/$F2" ]]; then + RF1="$TEST_SRCDIR/$F1" + RF2="$TEST_SRCDIR/$F2" else echo >&2 "ERROR: could not find \"{file1}\" and \"{file2}\"" exit 1 diff --git a/tests/diff_test/BUILD b/tests/diff_test/BUILD index bd0aacd..aa381d8 100644 --- a/tests/diff_test/BUILD +++ b/tests/diff_test/BUILD @@ -13,6 +13,8 @@ sh_test( "//rules:diff_test", "//tests:unittest.bash", ], + # Test marked local because it uses bazel. + tags = ["local"], deps = ["@bazel_tools//tools/bash/runfiles"], ) diff --git a/tests/diff_test/diff_test_tests.sh b/tests/diff_test/diff_test_tests.sh index aa43307..1cab39b 100755 --- a/tests/diff_test/diff_test_tests.sh +++ b/tests/diff_test/diff_test_tests.sh @@ -202,4 +202,5 @@ function test_from_ext_repo_without_legacy_external_runfiles() { assert_from_ext_repo "--nolegacy_external_runfiles" "${FUNCNAME[0]}" } +cd "$TEST_TMPDIR" run_suite "diff_test_tests test suite" diff --git a/tests/unittest_tests.bzl b/tests/unittest_tests.bzl index 01ea4de..e25e4da 100644 --- a/tests/unittest_tests.bzl +++ b/tests/unittest_tests.bzl @@ -1,3 +1,17 @@ +# Copyright 2019 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """Unit tests for unittest.bzl.""" load("//lib:unittest.bzl", "analysistest", "asserts", "unittest")