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 committed by GitHub
parent 3226e77485
commit 20e4ccbd33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();