From 00e482ce2dd0961d7d23eb9c92b833effa47a6fb Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 1 Jul 2021 09:59:24 +0200 Subject: [PATCH] Skip Brotli related tests on platforms which not support Brotli (#11435) Motivation: The native module is not yet available on aarch64 Mac / Windows thus causing tests in codec/ to fail (specifically all the Brotli ones, since the module could not be loaded). Modification: Disable Brotli tests when platform is not supported Result: Tests under codec/ now pass under Mac/aarch64 and Windows/aarch64 --- .../handler/codec/compression/BrotliDecoderTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/codec/src/test/java/io/netty/handler/codec/compression/BrotliDecoderTest.java b/codec/src/test/java/io/netty/handler/codec/compression/BrotliDecoderTest.java index 81299f554e..7bb50bfa93 100644 --- a/codec/src/test/java/io/netty/handler/codec/compression/BrotliDecoderTest.java +++ b/codec/src/test/java/io/netty/handler/codec/compression/BrotliDecoderTest.java @@ -21,8 +21,10 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.CompositeByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.embedded.EmbeddedChannel; +import io.netty.util.internal.PlatformDependent; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.condition.DisabledIf; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -33,6 +35,7 @@ import java.util.Random; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +@DisabledIf(value = "isNotSupported", disabledReason = "Brotli is not supported on this platform") public class BrotliDecoderTest { private static final Random RANDOM; @@ -58,6 +61,11 @@ public class BrotliDecoderTest { } } + static boolean isNotSupported() { + return (PlatformDependent.isOsx() || PlatformDependent.isWindows()) + && "aarch_64".equals(PlatformDependent.normalizedArch()); + } + private static void fillArrayWithCompressibleData(byte[] array) { for (int i = 0; i < array.length; i++) { array[i] = i % 4 != 0 ? 0 : (byte) RANDOM.nextInt();