diff options
author | Yun Peng <pcloudy@google.com> | 2018-06-25 05:35:50 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-25 05:36:55 -0700 |
commit | 40f5a773e97d0e389838becd3fe0a8ab43853999 (patch) | |
tree | 2c2aec321caa559b43787281fd097a7545eacc28 /src/test/py | |
parent | d753745d58fc45fcb50623073829644812083da0 (diff) |
Windows: Native launcher now works with unicode.
The native launcher can now launch Java and Bash binary in
directory with non-English characters.
Unfortunately, python doesn't support running python zip file under
directory with non-English characters. eg. python ./??/bin.zip will
still fail.
See https://github.com/bazelbuild/bazel/issues/4473
Change-Id: I77fe9cdaabffc2e0d25c7097da5c0c9333a9c4a3
PiperOrigin-RevId: 201939391
Diffstat (limited to 'src/test/py')
-rw-r--r-- | src/test/py/bazel/launcher_test.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/test/py/bazel/launcher_test.py b/src/test/py/bazel/launcher_test.py index 42d6efc600..95f38f36db 100644 --- a/src/test/py/bazel/launcher_test.py +++ b/src/test/py/bazel/launcher_test.py @@ -540,6 +540,57 @@ class LauncherTest(test_base.TestBase): classpath = stdout[stdout.index('-classpath') + 1] self.assertRegexpMatches(classpath, r'foo-[A-Za-z0-9]+-classpath.jar$') + def testWindowsNativeLauncherInNonEnglishPath(self): + if not self.IsWindows(): + return + self.ScratchFile('WORKSPACE') + self.ScratchFile('bin/BUILD', [ + 'java_binary(', + ' name = "bin_java",', + ' srcs = ["Main.java"],', + ' main_class = "Main",', + ')', + 'sh_binary(', + ' name = "bin_sh",', + ' srcs = ["main.sh"],', + ')', + ]) + self.ScratchFile('bin/Main.java', [ + 'public class Main {', + ' public static void main(String[] args) {' + ' System.out.println("helloworld");', + ' }', + '}', + ]) + self.ScratchFile('bin/main.sh', [ + 'echo "helloworld"', + ]) + + exit_code, stdout, stderr = self.RunBazel(['info', 'bazel-bin']) + self.AssertExitCode(exit_code, 0, stderr) + bazel_bin = stdout[0] + + exit_code, _, stderr = self.RunBazel( + ['build', '--windows_exe_launcher=1', '//bin/...']) + self.AssertExitCode(exit_code, 0, stderr) + + for f in [ + 'bin_java.exe', 'bin_java.exe.runfiles_manifest', 'bin_sh.exe', + 'bin_sh', 'bin_sh.exe.runfiles_manifest' + ]: + self.CopyFile(os.path.join(bazel_bin, 'bin', f), + os.path.join(u'./\u6d4b\u8bd5', f)) + + unicode_binary_path = u'./\u6d4b\u8bd5/bin_java.exe' + exit_code, stdout, stderr = self.RunProgram([unicode_binary_path]) + self.AssertExitCode(exit_code, 0, stderr) + self.assertEqual('helloworld', ''.join(stdout)) + + unicode_binary_path = u'./\u6d4b\u8bd5/bin_sh.exe' + exit_code, stdout, stderr = self.RunProgram([unicode_binary_path]) + self.AssertExitCode(exit_code, 0, stderr) + self.assertEqual('helloworld', ''.join(stdout)) + def AssertRunfilesManifestContains(self, manifest, entry): with open(manifest, 'r') as f: for l in f: |