dotnet-installer/tools/DebianPackageTool/test.sh

42 lines
975 B
Bash
Raw Normal View History

#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
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/bin
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 -i $input_dir -o $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