From: Kevin Day Date: Sun, 12 Dec 2021 17:36:01 +0000 (-0600) Subject: Feature: Add support for tests in the packager. X-Git-Tag: 0.5.7~39 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=0e7f0e55627673ae98579af15a2ddd781c6345da;p=fll Feature: Add support for tests in the packager. --- diff --git a/build/scripts/package.sh b/build/scripts/package.sh index 9fd4c07..b26cbac 100644 --- a/build/scripts/package.sh +++ b/build/scripts/package.sh @@ -1201,6 +1201,30 @@ package_operation_copy_package() { return $failure fi fi + + if [[ -d ${package}sources/tests/ ]] ; then + cp $verbose -R ${package}sources/tests/ ${package} + + if [[ $? -ne 0 ]] ; then + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Failed to move sources tests directory $c_notice${path_sources}sources/tests$c_error to $c_notice$package$c_error.$c_reset" + fi + + let failure=1 + return $failure + fi + + rm $verbose -Rf ${package}sources/tests/ + + if [[ $? -ne 0 ]] ; then + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Failed to remove sources tests directory $c_notice${path_sources}sources/tests$c_error to $c_notice$package$c_error.$c_reset" + fi + + let failure=1 + return $failure + fi + fi } package_operation_create_config_stubs() { @@ -1571,6 +1595,19 @@ package_operation_monolithic() { fi fi + if [[ ! -d ${package}tests/ ]] ; then + mkdir $verbose ${package}tests/ + + if [[ $? -ne 0 ]] ; then + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Failed to create directory $c_notice${package}tests$c_error.$c_reset" + fi + + package_cleanup + return 1 + fi + fi + for level in level_0 level_1 level_2 ; do for directory in $path_sources${level}/* ; do for subdirectory in $directory/* ; do @@ -1668,6 +1705,17 @@ package_operation_monolithic() { let failure=1 break fi + elif [[ $pathname == "tests" ]] ; then + cp $verbose -R $subdirectory ${package} + + if [[ $? -ne 0 ]] ; then + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}tests$c_error.$c_reset" + fi + + let failure=1 + break + fi else if [[ ! -d ${package}sources/$pathname/$level ]] ; then mkdir $verbose -p ${package}sources/$pathname/$level