Commit fabd69c6 authored by Phillip Smyth's avatar Phillip Smyth
Browse files

frontend/buildcheckout.py: Add build --world test

Added test files to be built using build --world
parent 8c9634e5
Loading
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
@@ -60,6 +60,47 @@ def test_build_checkout(datafiles, cli, strict, hardlinks):
    assert os.path.exists(filename)


@pytest.mark.datafiles(os.path.join(os.path.dirname(
    os.path.realpath(__file__)),
    "project_world",
))
@pytest.mark.parametrize("strict,hardlinks", [
    ("strict", "copies"),
    ("strict", "hardlinks"),
    ("non-strict", "copies"),
    ("non-strict", "hardlinks"),
])
def test_build_world_checkout(datafiles, cli, strict, hardlinks):
    project = os.path.join(datafiles.dirname, datafiles.basename)
    checkout = os.path.join(cli.directory, 'checkout')

    # First build it
    result = cli.run(project=project, args=strict_args(['build', '--world'], strict))
    result.assert_success()

    # Assert that after a successful build, the builddir is empty
    builddir = os.path.join(cli.directory, 'build')
    assert os.path.isdir(builddir)
    assert not os.listdir(builddir)

    # Prepare checkout args
    checkout_args = strict_args(['checkout'], strict)
    if hardlinks == "hardlinks":
        checkout_args += ['--hardlinks']
    checkout_args += ['target.bst', checkout]

    # Now check it out
    result = cli.run(project=project, args=checkout_args)
    result.assert_success()

    # Check that the executable hello file is found in the checkout
    filename = os.path.join(checkout, 'usr', 'bin', 'hello')
    assert os.path.exists(filename)

    filename = os.path.join(checkout, 'usr', 'include', 'pony.h')
    assert os.path.exists(filename)


@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("deps", [("run"), ("none")])
def test_build_checkout_deps(datafiles, cli, deps):
+12 −0
Original line number Diff line number Diff line
kind: compose

depends:
- filename: import-bin.bst
  type: build
- filename: import-dev.bst
  type: build

config:
  # Dont try running the sandbox, we dont have a
  # runtime to run anything in this context.
  integrate: False
+16 −0
Original line number Diff line number Diff line
kind: compose

depends:
- filename: import-bin.bst
  type: build
- filename: import-dev.bst
  type: build

config:
  # Dont try running the sandbox, we dont have a
  # runtime to run anything in this context.
  integrate: False

  # Exclude the dev domain
  exclude:
  - devel
+16 −0
Original line number Diff line number Diff line
kind: compose

depends:
- filename: import-bin.bst
  type: build
- filename: import-dev.bst
  type: build

config:
  # Dont try running the sandbox, we dont have a
  # runtime to run anything in this context.
  integrate: False

  # Only include the runtim
  include:
  - runtime
+4 −0
Original line number Diff line number Diff line
kind: import
sources:
- kind: local
  path: files/bin-files
Loading