[Fuego] [PATCH 05/14] Allow working_dir and install_dirs to be different

Tim.Bird at sony.com Tim.Bird at sony.com
Wed Apr 25 23:20:42 UTC 2018



> -----Original Message-----
> From: Guilherme Campos Camargo
> 
> The `working_dir` is where all the test assets reside and also where all
> the results (for instance the resulting images for the CheckScreenshot
> test) will be stored after the tests.
> 
> The `install_dir` is where the install script can be found.
> 
> `install_dir` is a required argument, while `working_dir` is optional
> and defaults to `install_dir`.
> 
> On this patch we're also modifying fuego_test.sh to copy the required
> assets from the test directory to the buildzone.

I'm not sure why this is needed.  I hate duplicating the files unnecessarily.
We could have lots of them eventually.

Why can't the assets just be accessed from the TEST_HOME directory?
 -- Tim

> 
> Signed-off-by: Guilherme Campos Camargo <guicc at profusion.mobi>
> ---
>  .../Functional.fuego_release_test/fuego_test.sh |  6 ++++--
>  .../Functional.fuego_release_test/test_run.py   | 17 ++++++++++++++---
>  2 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/engine/tests/Functional.fuego_release_test/fuego_test.sh
> b/engine/tests/Functional.fuego_release_test/fuego_test.sh
> index f0c872b..e87d6a4 100755
> --- a/engine/tests/Functional.fuego_release_test/fuego_test.sh
> +++ b/engine/tests/Functional.fuego_release_test/fuego_test.sh
> @@ -18,11 +18,13 @@ function test_build {
>      echo "Cloning fuego-core from
> ${fuego_core_repo}:${fuego_core_branch}"
>      git clone --depth 1 --single-branch --branch "${fuego_core_branch}" \
>          "${fuego_core_repo}" "${fuego_release_dir}/fuego-core"
> -    cd -
> +
> +    echo "Copying assets from ${TEST_HOME} to the buildzone."
> +    cp -r "${TEST_HOME}/screenshots" .
>  }
> 
>  function test_run {
> -    sudo -n ${TEST_HOME}/test_run.py "${fuego_release_dir}/fuego"
> +    sudo -n "${TEST_HOME}/test_run.py" "${fuego_release_dir}/fuego" -w .
>      if [ "${?}" = 0 ]; then
>          report "echo ok 1 fuego release test"
>      else
> diff --git a/engine/tests/Functional.fuego_release_test/test_run.py
> b/engine/tests/Functional.fuego_release_test/test_run.py
> index ed3c313..8b97bde 100755
> --- a/engine/tests/Functional.fuego_release_test/test_run.py
> +++ b/engine/tests/Functional.fuego_release_test/test_run.py
> @@ -638,7 +638,12 @@ def main():
>          return tests_ok
> 
>      parser = argparse.ArgumentParser()
> -    parser.add_argument('working_dir', help="The working directory",
> type=str)
> +    parser.add_argument('install_dir', help="The directory where the install "
> +                        "script resides.", type=str)
> +    parser.add_argument('-w', '--working_dir', help="The working directory.
> "
> +                        "Location of the test assets and where test results "
> +                        "will be stored. Defaults to install_dir.",
> +                        default=None, type=str)
>      parser.add_argument('-s', '--install-script',
>                          help="The script that will be used to install the " +
>                          "docker image. Defaults to '%s'" %
> @@ -672,8 +677,10 @@ def main():
>                          default=True, action='store_false')
>      args = parser.parse_args()
> 
> -    LOGGER.debug("Changing working dir to '%s'", args.working_dir)
> -    os.chdir(args.working_dir)
> +    args.install_dir, args.working_dir = get_abs_working_dirs()
> +
> +    LOGGER.debug("Changing working dir to '%s'", args.install_dir)
> +    os.chdir(args.install_dir)
> 
>      container = FuegoContainer(args.install_script, args.image_name,
>                                 args.container_name, args.jenkins_port,
> @@ -690,6 +697,10 @@ def main():
>      if not selenium_session.start():
>          return 1
> 
> +    if os.getcwd != args.working_dir:
> +        LOGGER.debug("Changing working dir to '%s'", args.working_dir)
> +        os.chdir(args.working_dir)
> +
>      COMMANDS_TO_TEST = [
>          # Set Selenium Browser root
>          Visit(url=container.get_url()),
> --
> 2.17.0
> 
> _______________________________________________
> Fuego mailing list
> Fuego at lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego


More information about the Fuego mailing list