Skip to content

Commit

Permalink
Skip tests in RBE
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Nov 5, 2024
1 parent 00abbae commit 83efae2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.TruthJUnit.assume;
import static java.lang.Math.min;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.charset.StandardCharsets.UTF_8;
Expand Down Expand Up @@ -44,6 +45,7 @@
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.Charset;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.attribute.PosixFilePermission;
Expand Down Expand Up @@ -1981,6 +1983,8 @@ public void testGetNioPath_basic() {

@Test
public void testGetNioPath_externalUtf8() throws IOException {
assumeUtf8CompatibleEncoding();

// Simulates a Starlark string constant, which is read from a presumably UTF-8 encoded source
// file into Bazel's internal representation.
Path utf8File = absolutize(StringEncoding.unicodeToInternal("some_dir/入力_A_🌱.txt"));
Expand All @@ -1997,6 +2001,8 @@ public void testGetNioPath_externalUtf8() throws IOException {

@Test
public void testGetNioPath_internalUtf8() throws IOException {
assumeUtf8CompatibleEncoding();

Path dirPath = absolutize("some_dir");
dirPath.createDirectoryAndParents();

Expand Down Expand Up @@ -2036,11 +2042,16 @@ protected java.nio.file.Path getJavaPathOrSkipIfUnsupported(Path path) {
return javaPath;
}

protected String unicodeToPlatform(String s) {
protected static String unicodeToPlatform(String s) {
return StringEncoding.internalToPlatform(StringEncoding.unicodeToInternal(s));
}

protected String platformToUnicode(String s) {
protected static String platformToUnicode(String s) {
return StringEncoding.internalToUnicode(StringEncoding.platformToInternal(s));
}

protected static void assumeUtf8CompatibleEncoding() {
Charset sunJnuEncoding = Charset.forName(System.getProperty("sun.jnu.encoding"));
assume().that(ImmutableList.of(UTF_8, ISO_8859_1)).contains(sunJnuEncoding);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,8 @@ public void testCreatingFileInLinkedDirectory() throws Exception {

@Test
public void testUtf8Symlink() throws Exception {
assumeUtf8CompatibleEncoding();

String target = StringEncoding.unicodeToInternal("入力_A_🌱.target");
Path link = absolutize(StringEncoding.unicodeToInternal("入力_A_🌱.txt"));
createSymbolicLink(link, PathFragment.create(target));
Expand Down

0 comments on commit 83efae2

Please sign in to comment.