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
This commit is contained in:
Norman Maurer 2021-07-01 09:59:24 +02:00
parent ea2654e9cc
commit 00e482ce2d

View File

@ -21,8 +21,10 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.CompositeByteBuf; import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.embedded.EmbeddedChannel; import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.util.internal.PlatformDependent;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource; 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.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
@DisabledIf(value = "isNotSupported", disabledReason = "Brotli is not supported on this platform")
public class BrotliDecoderTest { public class BrotliDecoderTest {
private static final Random RANDOM; 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) { private static void fillArrayWithCompressibleData(byte[] array) {
for (int i = 0; i < array.length; i++) { for (int i = 0; i < array.length; i++) {
array[i] = i % 4 != 0 ? 0 : (byte) RANDOM.nextInt(); array[i] = i % 4 != 0 ? 0 : (byte) RANDOM.nextInt();