tests: Add support for functional only tests

Modify the ClassicTest class to only emit a stat verification test
unit if there is a reference stat file. This makes it possible to
design tests that don't care about stat changes.

To generate purely functional tests, we need to be able to create
empty test reference directories. This does not work well with many
revision control systems. As a workaround, add a file named EMPTY to
the list of ignored files in the test harness. This file can be used
as a placeholder in otherwise empty test directories.

Change-Id: I583c8c4e55479f0d48fa99d0b0d1eac9221e6652
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
This commit is contained in:
Andreas Sandberg 2016-09-16 09:04:20 +01:00
parent 18461d1522
commit 1ecc3628a8

View file

@ -236,6 +236,7 @@ class ClassicTest(Test):
# and other files that we don't care about.
ref_ignore_files = FileIgnoreList(
names=(
"EMPTY",
), rex=(
# Mercurial sometimes leaves backups when applying MQ patches
r"\.orig$",
@ -284,17 +285,21 @@ class ClassicTest(Test):
]
def verify_units(self):
return [
DiffStatFile(ref_dir=self.ref_dir, test_dir=self.output_dir,
skip=self.skip_diff_stat)
] + [
ref_files = set(self.ref_files())
units = []
if "stats.txt" in ref_files:
units.append(
DiffStatFile(ref_dir=self.ref_dir, test_dir=self.output_dir,
skip=self.skip_diff_stat))
units += [
DiffOutFile(f,
ref_dir=self.ref_dir, test_dir=self.output_dir,
skip=self.skip_diff_out)
for f in self.ref_files()
if f not in ClassicTest.diff_ignore_files
for f in ref_files if f not in ClassicTest.diff_ignore_files
]
return units
def update_ref(self):
for fname in self.ref_files():
shutil.copy(