Added example test script with sanitized test data

This commit is contained in:
Jonas Finnemann Jensen 2013-12-03 17:48:14 -08:00
Родитель 98e247a665
Коммит f6197f5f4c
5 изменённых файлов: 64 добавлений и 0 удалений

27
analysis/example/processor Executable file
Просмотреть файл

@ -0,0 +1,27 @@
#!/bin/bash
# Number of rows counted
rows=0;
# Read stdin line by line
while read -r line; do
# Skip empty-lines, last line may be empty
if [ "$line" == "" ]; then
continue;
fi;
# Split input
prefix=`echo "$line" | cut -f 1`;
path=`echo "$line" | cut -f 2`;
# Count number of rows
new_rows=`xz -dc $path | wc -l`;
rows=$(($rows + $new_rows));
# Delete input file
rm $path;
done;
# Output aggregated values to files in folder provided as first argument
echo "$rows" > $1/rows_counted.txt;

Просмотреть файл

@ -0,0 +1,2 @@
saved_session/Firefox/nightly/22.0a1/20130226031002.20131011.v2.log.e28a4032eb744f089a1828ac7399e5d8.lzma input/ss-ff-n-22.lzma
saved_session/Firefox/nightly/28.0a1/20131029030201.20131029.v2.log.0ab8723b6fb3455bb34b04d97482fda2.lzma input/ss-ff-n-28.lzma

Двоичные данные
analysis/example/test/ss-ff-n-22.lzma Normal file

Двоичный файл не отображается.

Двоичные данные
analysis/example/test/ss-ff-n-28.lzma Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,35 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# This tests a processor, and takes a processor job_bundle as input argument
# that is a tarball containing a script called `processor` which is to be given
# files as input and output results into a single file
echo "### Setting up test environment";
# Create test-folders
mkdir -p test-folder/input;
mkdir -p test-folder/output;
# Copy in job_bundle
cp $1 test-folder/job_bundle.tar.gz
# Copy in test files
cp $DIR/ss-ff-n-22.lzma test-folder/input/ss-ff-n-22.lzma
cp $DIR/ss-ff-n-28.lzma test-folder/input/ss-ff-n-28.lzma
# Extract job_bundle
cd test-folder;
tar -xzf job_bundle.tar.gz;
# Run tests
echo "### Running processor";
cat $DIR//input.txt | ./processor output/;
echo "### Files produced";
find output/;
if [ `ls input/ | wc -l` -ne "0" ]; then
echo "### WARNING";
echo "Input files where not deleted, please do this as they are consumed.";
fi;