From 0d04e1b7db7e7612a2d2ca13652e7c425e519650 Mon Sep 17 00:00:00 2001 From: William Salmon Date: Wed, 10 Oct 2018 11:41:05 +0100 Subject: Added tests for conf-root variable For issue #512 in Gitlab. --- tests/integration/autotools.py | 24 ++++++++++++++++++++++ tests/integration/cmake.py | 18 ++++++++++++++++ .../project/elements/autotools/amhelloconfroot.bst | 15 ++++++++++++++ .../project/elements/cmake/cmakeconfroothello.bst | 15 ++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 tests/integration/project/elements/autotools/amhelloconfroot.bst create mode 100644 tests/integration/project/elements/cmake/cmakeconfroothello.bst (limited to 'tests/integration') diff --git a/tests/integration/autotools.py b/tests/integration/autotools.py index 6ea2b667c..3c4981365 100644 --- a/tests/integration/autotools.py +++ b/tests/integration/autotools.py @@ -38,6 +38,30 @@ def test_autotools_build(cli, tmpdir, datafiles): '/usr/share/doc/amhello/README']) +# Test that an autotools build 'works' - we use the autotools sample +# amhello project for this. +@pytest.mark.integration +@pytest.mark.datafiles(DATA_DIR) +def test_autotools_confroot_build(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + checkout = os.path.join(cli.directory, 'checkout') + element_name = 'autotools/amhelloconfroot.bst' + + result = cli.run(project=project, args=['build', element_name]) + assert result.exit_code == 0 + + result = cli.run(project=project, args=['checkout', element_name, checkout]) + assert result.exit_code == 0 + + assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin', + '/usr/share', '/usr/lib/debug', + '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello', + '/usr/bin/hello', '/usr/share/doc', + '/usr/share/doc/amhello', + '/usr/share/doc/amhello/README']) + + # Test running an executable built with autotools @pytest.mark.datafiles(DATA_DIR) def test_autotools_run(cli, tmpdir, datafiles): diff --git a/tests/integration/cmake.py b/tests/integration/cmake.py index 3c16b29b9..e74958b91 100644 --- a/tests/integration/cmake.py +++ b/tests/integration/cmake.py @@ -32,6 +32,24 @@ def test_cmake_build(cli, tmpdir, datafiles): '/usr/lib/debug/usr/bin/hello']) +@pytest.mark.datafiles(DATA_DIR) +def test_cmake_confroot_build(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + checkout = os.path.join(cli.directory, 'checkout') + element_name = 'cmake/cmakeconfroothello.bst' + + result = cli.run(project=project, args=['build', element_name]) + assert result.exit_code == 0 + + result = cli.run(project=project, args=['checkout', element_name, checkout]) + assert result.exit_code == 0 + + assert_contains(checkout, ['/usr', '/usr/bin', '/usr/bin/hello', + '/usr/lib/debug', '/usr/lib/debug/usr', + '/usr/lib/debug/usr/bin', + '/usr/lib/debug/usr/bin/hello']) + + @pytest.mark.datafiles(DATA_DIR) def test_cmake_run(cli, tmpdir, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename) diff --git a/tests/integration/project/elements/autotools/amhelloconfroot.bst b/tests/integration/project/elements/autotools/amhelloconfroot.bst new file mode 100644 index 000000000..28926446b --- /dev/null +++ b/tests/integration/project/elements/autotools/amhelloconfroot.bst @@ -0,0 +1,15 @@ +kind: autotools +description: Autotools test + +depends: +- base.bst + +sources: +- kind: tar + url: project_dir:/files/amhello.tar.gz + ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590 + directory: SourceFile + +variables: + conf-root: "%{build-root}/SourceFile" + command-subdir: build diff --git a/tests/integration/project/elements/cmake/cmakeconfroothello.bst b/tests/integration/project/elements/cmake/cmakeconfroothello.bst new file mode 100644 index 000000000..cd33dee99 --- /dev/null +++ b/tests/integration/project/elements/cmake/cmakeconfroothello.bst @@ -0,0 +1,15 @@ +kind: cmake +description: Cmake test + +depends: + - base.bst + +sources: + - kind: tar + directory: Source + url: project_dir:/files/cmakehello.tar.gz + ref: 508266f40dbc5875293bd24c4e50a9eb6b88cbacab742033f7b92f8c087b64e5 + +variables: + conf-root: "%{build-root}/Source" + command-subdir: build -- cgit v1.2.1