Skip to content
Snippets Groups Projects
Commit f5ed5eb4 authored by Phillip Smyth's avatar Phillip Smyth
Browse files

frontend/buildcheckout.py: build default element

Added supporting files for build default element tests
parent a0ec6ae5
No related branches found
No related tags found
No related merge requests found
Pipeline #39750439 failed
Showing
with 167 additions and 0 deletions
......@@ -60,6 +60,64 @@ 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_default_all_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'], 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 + "_default")
def test_show_default(cli, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
prev_dir = os.getcwd()
os.chdir(project)
result = cli.run(project=project, silent=True, args=[
'build'])
os.chdir(prev_dir)
result.assert_success()
results = cli.get_element_state(project, "target2.bst")
expected = "cached"
if results != expected:
raise AssertionError("Expected output:\n{}\nInstead received output:\n{}"
.format(expected, result))
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("strict,hardlinks", [
("non-strict", "hardlinks"),
......
kind: stack
description: |
Main stack target for the bst build test
kind: stack
description: |
Main stack target for the bst build test
# Project config for frontend build test
name: test
element-path: elements
fatal-warnings:
- bad-element-suffix
defaults:
target-element: target2.bst
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
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
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
kind: import
sources:
- kind: local
path: files/bin-files
kind: import
sources:
- kind: local
path: files/dev-files
kind: compose
build-depends:
- target.bst
kind: import
description: the kind of this element must implement generate_script() method
sources:
- kind: local
path: files/source-bundle
kind: stack
description: |
Main stack target for the bst build test
depends:
- import-bin.bst
- compose-all.bst
#!/bin/bash
echo "Hello !"
test
#ifndef __PONY_H__
#define __PONY_H__
#define PONY_BEGIN "Once upon a time, there was a pony."
#define PONY_END "And they lived happily ever after, the end."
#define MAKE_PONY(story) \
PONY_BEGIN \
story \
PONY_END
#endif /* __PONY_H__ */
llamas
# Project config for frontend build test
name: test
element-path: elements
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment