Skip to content

Commit

Permalink
Add unicode_test to Bazel shell integration tests
Browse files Browse the repository at this point in the history
Missing from bazelbuild@f00439d

PiperOrigin-RevId: 544451711
Change-Id: Ie7d897e4743d4cba4beaef986b6e978d80c3680a
  • Loading branch information
tetromino authored and copybara-github committed Jun 29, 2023
1 parent 990d97e commit dac1780
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
14 changes: 14 additions & 0 deletions src/test/shell/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,20 @@ sh_test(
tags = ["no_windows"],
)

sh_test(
name = "unicode_test",
srcs = ["unicode_test.sh"],
data = [
"unicode_test.bzl",
"unicode_test_BUILD",
"unicode_test_expected.txt",
":test-deps",
"@bazel_tools//tools/bash/runfiles",
],
# TODO(arostovtsev): figure out how to make this test Windows-compatible.
tags = ["no_windows"],
)

########################################################################
# Test suites.

Expand Down
18 changes: 11 additions & 7 deletions src/test/shell/integration/unicode_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$(rlocation "io_bazel/src/test/shell/integration_test_setup.sh")" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }

touch WORKSPACE
cp "$(rlocation "io_bazel/src/test/shell/integration/unicode_test_BUILD")" BUILD
cp "$(rlocation "io_bazel/src/test/shell/integration/unicode_test.bzl")" .
cp "$(rlocation "io_bazel/src/test/shell/integration/unicode_test_expected.txt")" .
export LC_ALL="C.UTF-8"

function set_up {
touch WORKSPACE
cp -f "$(rlocation "io_bazel/src/test/shell/integration/unicode_test_BUILD")" BUILD
cp -f "$(rlocation "io_bazel/src/test/shell/integration/unicode_test.bzl")" .
cp -f "$(rlocation "io_bazel/src/test/shell/integration/unicode_test_expected.txt")" .
}

function test_unicode_genrule_cmd {
local test_name="genrule_cmd"
bazel build --genrule_strategy=local --spawn_strategy=local \
--verbose_failures "${test_name}" >& "$TEST_log" \
--verbose_failures "//:${test_name}" >& "$TEST_log" \
|| fail "expected build to succeed"

diff -u "${PRODUCT_NAME}-genfiles/${test_name}.out" \
Expand All @@ -49,7 +53,7 @@ function test_unicode_genrule_cmd {
function test_unicode_action_run_argument {
local test_name="action_run_argument"
bazel build --genrule_strategy=local --spawn_strategy=local \
--verbose_failures "${test_name}" >& "$TEST_log" \
--verbose_failures "//:${test_name}" >& "$TEST_log" \
|| fail "expected build to succeed"

diff -u "${PRODUCT_NAME}-bin/${test_name}.out" \
Expand All @@ -60,7 +64,7 @@ function test_unicode_action_run_argument {
function test_unicode_action_write_content {
local test_name="action_write_content"
bazel build --genrule_strategy=local --spawn_strategy=local \
--verbose_failures "${test_name}" >& "$TEST_log" \
--verbose_failures "//:${test_name}" >& "$TEST_log" \
|| fail "expected build to succeed"

diff -u "${PRODUCT_NAME}-bin/${test_name}.out" \
Expand Down

0 comments on commit dac1780

Please sign in to comment.