dotnet-installer/package_tool/test.sh

38 lines
795 B
Bash
Raw Normal View History

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
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(){
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(){
input_dir=$DIR/test/test_assets/test_package_layout
output_dir=$DIR/p_out
2015-10-15 23:16:58 +00:00
# Create output dir
mkdir -p $output_dir
2015-10-15 23:16:58 +00:00
# Build the actual package
$DIR/package_tool $input_dir $output_dir
2015-10-15 23:16:58 +00:00
# Integration Test Entrypoint placed by package_tool
bats $output_dir/test_package.bats
2015-10-15 23:16:58 +00:00
# Cleanup output dir
rm -rf $DIR/test/test_assets/test_package_output
2015-10-15 23:16:58 +00:00
}
run_all(){
run_unit_tests
run_integration_tests
2015-10-15 23:16:58 +00:00
}
run_all