2015-10-15 23:16:58 +00:00
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2015-10-16 00:41:50 +00:00
|
|
|
current_user=$(whoami)
|
|
|
|
if [ $current_user != "root" ]; then
|
2015-10-16 19:13:52 +00:00
|
|
|
echo "test.sh requires superuser privileges to run"
|
|
|
|
exit 1
|
2015-10-16 00:41:50 +00:00
|
|
|
fi
|
2015-10-15 23:16:58 +00:00
|
|
|
|
|
|
|
run_unit_tests(){
|
2015-10-16 19:13:52 +00:00
|
|
|
bats $DIR/test/unit_tests/test_debian_build_lib.bats
|
|
|
|
bats $DIR/test/unit_tests/test_scripts.bats
|
2015-10-15 23:16:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_integration_tests(){
|
2015-10-16 19:13:52 +00:00
|
|
|
input_dir=$DIR/test/test_assets/test_package_layout
|
|
|
|
output_dir=$DIR/p_out
|
2015-10-15 23:16:58 +00:00
|
|
|
|
2015-10-16 19:13:52 +00:00
|
|
|
# Create output dir
|
|
|
|
mkdir -p $output_dir
|
2015-10-15 23:16:58 +00:00
|
|
|
|
2015-10-16 19:13:52 +00:00
|
|
|
# Build the actual package
|
|
|
|
$DIR/package_tool $input_dir $output_dir
|
2015-10-15 23:16:58 +00:00
|
|
|
|
2015-10-16 19:13:52 +00:00
|
|
|
# Integration Test Entrypoint placed by package_tool
|
|
|
|
bats $output_dir/test_package.bats
|
2015-10-15 23:16:58 +00:00
|
|
|
|
2015-10-16 19:13:52 +00:00
|
|
|
# Cleanup output dir
|
|
|
|
rm -rf $DIR/test/test_assets/test_package_output
|
2015-10-15 23:16:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_all(){
|
2015-10-16 19:13:52 +00:00
|
|
|
run_unit_tests
|
|
|
|
run_integration_tests
|
2015-10-15 23:16:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_all
|