From 5595f421f4d81f079f14f35bedef3aac5d011626 Mon Sep 17 00:00:00 2001
From: Panagiotis Liakos
Date: Wed, 1 Jun 2022 13:43:53 +0300
Subject: [PATCH] reproducible tests
---
...mpressBenchmark.java => TestDoublePrecision.java} | 2 +-
.../{CompressBenchmarkLossy.java => TestLossy.java} | 2 +-
...SinglePrecision.java => TestSinglePrecision.java} | 12 +++++++-----
src/test/resources/log4j.properties | 10 ----------
src/test/resources/logback-test.xml | 11 +++++++++++
5 files changed, 20 insertions(+), 17 deletions(-)
rename src/test/java/gr/aueb/delorean/chimp/benchmarks/{CompressBenchmark.java => TestDoublePrecision.java} (99%)
rename src/test/java/gr/aueb/delorean/chimp/benchmarks/{CompressBenchmarkLossy.java => TestLossy.java} (99%)
rename src/test/java/gr/aueb/delorean/chimp/benchmarks/{CompressBenchmarkSinglePrecision.java => TestSinglePrecision.java} (99%)
delete mode 100644 src/test/resources/log4j.properties
create mode 100644 src/test/resources/logback-test.xml
diff --git a/src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmark.java b/src/test/java/gr/aueb/delorean/chimp/benchmarks/TestDoublePrecision.java
similarity index 99%
rename from src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmark.java
rename to src/test/java/gr/aueb/delorean/chimp/benchmarks/TestDoublePrecision.java
index 44496b1..aa76023 100644
--- a/src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmark.java
+++ b/src/test/java/gr/aueb/delorean/chimp/benchmarks/TestDoublePrecision.java
@@ -39,7 +39,7 @@
* the value compression.
*
*/
-public class CompressBenchmark {
+public class TestDoublePrecision {
private static final int MINIMUM_TOTAL_BLOCKS = 50_000;
private static String[] FILENAMES = {
diff --git a/src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmarkLossy.java b/src/test/java/gr/aueb/delorean/chimp/benchmarks/TestLossy.java
similarity index 99%
rename from src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmarkLossy.java
rename to src/test/java/gr/aueb/delorean/chimp/benchmarks/TestLossy.java
index 09fea5b..8a0c6c9 100644
--- a/src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmarkLossy.java
+++ b/src/test/java/gr/aueb/delorean/chimp/benchmarks/TestLossy.java
@@ -23,7 +23,7 @@
* the value compression.
*
*/
-public class CompressBenchmarkLossy {
+public class TestLossy {
private static final int MINIMUM_TOTAL_BLOCKS = 50_000;
private static String[] FILENAMES = {
diff --git a/src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmarkSinglePrecision.java b/src/test/java/gr/aueb/delorean/chimp/benchmarks/TestSinglePrecision.java
similarity index 99%
rename from src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmarkSinglePrecision.java
rename to src/test/java/gr/aueb/delorean/chimp/benchmarks/TestSinglePrecision.java
index e80ec05..db156fe 100644
--- a/src/test/java/gr/aueb/delorean/chimp/benchmarks/CompressBenchmarkSinglePrecision.java
+++ b/src/test/java/gr/aueb/delorean/chimp/benchmarks/TestSinglePrecision.java
@@ -5,8 +5,6 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -33,12 +31,14 @@
import gr.aueb.delorean.chimp.Decompressor32;
import gr.aueb.delorean.chimp.Value;
+
+
/**
* These are generic tests to test that input matches the output after compression + decompression cycle, using
* the value compression.
*
*/
-public class CompressBenchmarkSinglePrecision {
+public class TestSinglePrecision {
private static final int MINIMUM_TOTAL_BLOCKS = 50_000;
private static String[] FILENAMES = {
@@ -47,6 +47,8 @@ public class CompressBenchmarkSinglePrecision {
"/SSD_HDD_benchmarks.csv.gz"
};
+
+
@Test
public void testChimpN32() throws IOException {
int previousValues = 64;
@@ -129,7 +131,7 @@ public void testChimp32() throws IOException {
@Test
public void testCorilla32() throws IOException {
for (String filename : FILENAMES) {
- TimeseriesFileReader timeseriesFileReader = new TimeseriesFileReader(new FileInputStream(new File(filename)));
+ TimeseriesFileReader timeseriesFileReader = new TimeseriesFileReader(getClass().getResourceAsStream(filename));
long totalSize = 0;
float totalBlocks = 0;
double[] values;
@@ -137,7 +139,7 @@ public void testCorilla32() throws IOException {
long decodingDuration = 0;
while ((values = timeseriesFileReader.nextBlock()) != null || totalBlocks < MINIMUM_TOTAL_BLOCKS) {
if (values == null) {
- timeseriesFileReader = new TimeseriesFileReader(new FileInputStream(new File(filename)));
+ timeseriesFileReader = new TimeseriesFileReader(getClass().getResourceAsStream(filename));
values = timeseriesFileReader.nextBlock();
}
ByteBufferBitOutput output = new ByteBufferBitOutput();
diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties
deleted file mode 100644
index 46a56ef..0000000
--- a/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-
-# Root logger option
-log4j.rootLogger=INFO, stdout
-
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
-
diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..abeb1bf
--- /dev/null
+++ b/src/test/resources/logback-test.xml
@@ -0,0 +1,11 @@
+
+
+
+ %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
\ No newline at end of file