Test/stages: check dracut stage output for environment warnings
Extend the dracut stage test case with checks for error / warning messages complaining about unsupported / incorrect runtime environment. Messages such as: ``` /dev/fd/63: No such file or directory ``` or ``` /proc/ is not mounted. This is not a supported mode of operation. Please fix your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway. Your mileage may vary. ``` The stage will be fixed in the next commit. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
761c03611b
commit
a0b44c5c72
1 changed files with 16 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ import json
|
||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
@ -261,10 +262,21 @@ class TestStages(test.TestBase):
|
||||||
|
|
||||||
with self.osbuild as osb, tempfile.TemporaryDirectory(dir="/var/tmp") as outdir:
|
with self.osbuild as osb, tempfile.TemporaryDirectory(dir="/var/tmp") as outdir:
|
||||||
|
|
||||||
osb.compile_file(f"{base}/template.json",
|
output = osb.compile_file(f"{base}/template.json",
|
||||||
checkpoints=["tree"],
|
checkpoints=["tree"],
|
||||||
exports=["tree"],
|
exports=["tree"],
|
||||||
output_dir=outdir)
|
output_dir=outdir)
|
||||||
|
|
||||||
|
# check that there are no complains about the runtime environment
|
||||||
|
tree_stages_log = output["log"]["tree"]
|
||||||
|
dracut_stages = [stage for stage in tree_stages_log if stage["type"] == "org.osbuild.dracut"]
|
||||||
|
assert len(dracut_stages) == 1
|
||||||
|
dracut_stage_log = dracut_stages[0]["output"]
|
||||||
|
proc_warnings_re = re.compile(r'.*\/proc\/ is not mounted\. This is not a supported mode of operation\..*')
|
||||||
|
assert proc_warnings_re.search(dracut_stage_log, re.DOTALL) is None
|
||||||
|
dev_warnings_re = re.compile(r'.*\/dev\/fd\/63: No such file or directory.*')
|
||||||
|
assert dev_warnings_re.search(dracut_stage_log, re.DOTALL) is None
|
||||||
|
|
||||||
tree = os.path.join(outdir, "tree")
|
tree = os.path.join(outdir, "tree")
|
||||||
|
|
||||||
for name, want in refs.items():
|
for name, want in refs.items():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue