Skip to content
Snippets Groups Projects
Commit 82952838 authored by Anh Nguyen-Tuong's avatar Anh Nguyen-Tuong
Browse files

Add functional tests

parent f3875e00
No related branches found
No related tags found
No related merge requests found
TMP_FILE_1=/tmp/gzip.tmp.$$
TMP_FILE_2=/tmp/gzip.tmp.$$
cleanup()
{
rm -fr /tmp/gzip.tmp* gzip*.zafl peasoup_exec*.gzip*
}
log_error()
{
echo "FAIL: $1"
cleanup
exit 1
}
log_message()
{
echo "$1"
}
log_success()
{
echo "PASS: $1"
}
setup()
{
echo "hello" > $TMP_FILE_1
echo "hello" > $TMP_FILE_2
}
build_zafl()
{
gzip_zafl=$1
shift
$PSZ `which gzip` $gzip_zafl -c move_globals=on -c zafl=on -o move_globals:--elftables $*
if [ ! $? -eq 0 ]; then
log_error "$gzip_zafl: unable to generate Zafl version"
else
log_message "$gzip_zafl: built successfully"
fi
}
test_zafl()
{
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SECURITY_TRANSFORMS_HOME/lib/ $1 $TMP_FILE_1
if [ ! $? -eq 0 ]; then
log_error "$1: unable to gzip file using zafl"
fi
gunzip ${TMP_FILE_1}.gz
diff $TMP_FILE_1 $TMP_FILE_2
if [ $? -eq 0 ]; then
log_success "$1: after unzipping, we get the same file back. yeah!"
else
log_error "$1: after unzipping, we get a diferent file"
fi
}
pushd /tmp
setup
build_zafl gzip.nostars.zafl
test_zafl ./gzip.nostars.zafl
cleanup
setup
build_zafl gzip.zafl
test_zafl ./gzip.zafl
cleanup
log_success "all tests passed"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment