Skip to content
Snippets Groups Projects
Commit d666ced4 authored by Simon Rose's avatar Simon Rose
Browse files

Add tests for architecture filtering

Note that there is something surprising here: `EXCLUDE_ARCHS` _filters_
the architectures (i.e. runs it as %arch%), while `ARCH_FILTER` matches
exactly. This is exactly backwards from what the names suggest.

However, I am leaving this as is for the time being since there are
possibly existing wrappers that use these two variables in this way; a
further investigation should be done to ensure that we can improve this
in some sense. If we make such a change, we should regard it as breaking.
parent 7587c759
No related branches found
No related tags found
1 merge request!89E3-453: Remove EPICSVERSION loop
import os
import re
from pathlib import Path
import pytest
from .utils import run_ioc_get_output
MODULE_VERSION = "0.0.0+0"
......@@ -467,3 +470,28 @@ def test_updated_template_files(wrapper):
rc, *_ = wrapper.run_make("db_internal")
assert rc == 0
assert db_file.read_text() == "record(ai, updated) {}"
@pytest.mark.parametrize(
"installed_archs, param, expected",
[
("foo bar baz foo-bar", "ARCH_FILTER=foo", ["foo"]),
("foo", "EXCLUDE_ARCHS=foo", []),
("foo-bar foo-baz baz baz-qux", "EXCLUDE_ARCHS=foo", ["baz", "baz-qux"]),
],
)
def test_arch_filter(wrapper, installed_archs, param, expected):
arch_regex = re.compile(r"Pass 3: T_A =\s*([^\s]+)")
wrapper.add_var_to_makefile(
"CROSS_COMPILER_TARGET_ARCHS", installed_archs, modifier=""
)
rc, o, _ = wrapper.run_make("debug", param)
assert rc == 0
host_arch = os.getenv("EPICS_HOST_ARCH")
build_archs = [arch for arch in arch_regex.findall(o) if arch != host_arch]
assert build_archs == expected
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