diff --git a/tests/test_build.py b/tests/test_build.py
index c7875620614cbe1345406739769abe4eef56867a..9f960958eda8dd6caf0a0889aa57ef5ba9af662f 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -1,6 +1,9 @@
+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