Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Fix to Prevent Checks Dealing with Large Array Sizes #459

Merged
merged 6 commits into from
Jun 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/test/java/org/xerial/snappy/SnappyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;

import org.junit.Assume;
import org.junit.Assert;
import org.junit.Test;
import org.xerial.util.log.Logger;
Expand Down Expand Up @@ -415,31 +416,37 @@ public void isValidArrayInputLength()
*/
@Test(expected = SnappyError.class)
public void isTooLargeDoubleArrayInputLength() throws Exception {
assumingCIIsFalse();
Snappy.compress(new double[Integer.MAX_VALUE / 8 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeCharArrayInputLength() throws Exception {
assumingCIIsFalse();
Snappy.compress(new char[Integer.MAX_VALUE / 2 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeFloatArrayInputLength() throws Exception {
assumingCIIsFalse();
Snappy.compress(new float[Integer.MAX_VALUE / 4 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeIntArrayInputLength() throws Exception {
assumingCIIsFalse();
Snappy.compress(new int[Integer.MAX_VALUE / 4 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeLongArrayInputLength() throws Exception {
assumingCIIsFalse();
Snappy.compress(new long[Integer.MAX_VALUE / 8 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeShortArrayInputLength() throws Exception {
assumingCIIsFalse();
Snappy.compress(new short[Integer.MAX_VALUE / 2 + 1]);
}

Expand Down Expand Up @@ -474,28 +481,37 @@ public void isValidArrayInputLengthForBitShuffleShuffle()
*/
@Test(expected = SnappyError.class)
public void isTooLargeDoubleArrayInputLengthForBitShuffleShuffle() throws Exception {
assumingCIIsFalse();
BitShuffle.shuffle(new double[Integer.MAX_VALUE / 8 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeFloatArrayInputLengthForBitShuffleShuffle() throws Exception {
assumingCIIsFalse();
BitShuffle.shuffle(new float[Integer.MAX_VALUE / 4 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeIntArrayInputLengthForBitShuffleShuffle() throws Exception {
assumingCIIsFalse();
BitShuffle.shuffle(new float[Integer.MAX_VALUE / 4 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeLongArrayInputLengthForBitShuffleShuffle() throws Exception {
assumingCIIsFalse();
BitShuffle.shuffle(new long[Integer.MAX_VALUE / 8 + 1]);
}

@Test(expected = SnappyError.class)
public void isTooLargeShortArrayInputLengthForBitShuffleShuffle() throws Exception {
assumingCIIsFalse();
BitShuffle.shuffle(new short[Integer.MAX_VALUE / 2 + 1]);
}


private void assumingCIIsFalse() {
if (System.getenv("CI") == null)
return;
Assume.assumeFalse("Skipped on CI", System.getenv("CI").equals("true"));
}
}