2015-11-16 19:21:57 +00:00
|
|
|
#
|
|
|
|
# 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
|
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
|
2016-01-12 23:27:02 +00:00
|
|
|
output_dir=$DIR/bin
|
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
|
2016-01-07 00:46:25 +00:00
|
|
|
$DIR/package_tool -i $input_dir -o $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
|