diff --git a/e2e/qemu/BUILD.bazel b/e2e/qemu/BUILD.bazel index 220e81cd549da52a4ca3a91e782222f9d31cdb79..a92c7ff7bcda6f40916e988f6673660d58957c04 100644 --- a/e2e/qemu/BUILD.bazel +++ b/e2e/qemu/BUILD.bazel @@ -1,5 +1,7 @@ load("@rules_diff//diff/file/test:defs.bzl", "diff_file_test") load("@rules_labgrid//labgrid/run:defs.bzl", "labgrid_run") +load("@rules_labgrid//labgrid/test:defs.bzl", "labgrid_test") +load("@rules_python//python:defs.bzl", "py_binary") CPUS = ("amd64", "arm64") @@ -28,3 +30,26 @@ test_suite( name = "run", tests = ["run-{}".format(cpu) for cpu in CPUS], ) + +py_binary( + name = "inner", + srcs = ["test_release.py"], + data = [":release.txt"], + main = "test_release.py", + deps = ["@rules_python//python/runfiles"], +) + +[ + labgrid_test( + name = "test-{}".format(cpu), + size = "large", + src = ":inner", + platform = "@rules_labgrid//platform:qemu-{}-linux".format(cpu), + ) + for cpu in CPUS +] + +test_suite( + name = "test", + tests = ["test-{}".format(cpu) for cpu in CPUS], +) diff --git a/e2e/qemu/test_release.py b/e2e/qemu/test_release.py new file mode 100644 index 0000000000000000000000000000000000000000..7bb5844e27f4d6fd52e72801f994906906641e39 --- /dev/null +++ b/e2e/qemu/test_release.py @@ -0,0 +1,22 @@ +import unittest +from pathlib import Path + +from python.runfiles import Runfiles + + +def _cat(path): + return Path(path).read_text() + + +def _runfile(path): + r = Runfiles.Create() + return _cat(r.Rlocation(path)) + + +class ReleaseTestCase(unittest.TestCase): + def test(self): + self.assertEqual(_cat("/etc/os-release"), _runfile("_main/qemu/release.txt")) + + +if __name__ == "__main__": + unittest.main()