diff options
author | Petri Latvala <petri.latvala@intel.com> | 2018-08-08 14:07:01 +0300 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2018-08-09 10:34:03 +0300 |
commit | 6cb3d7dbe5831a7b2b5b7a4638d8a8b7ac624f5f (patch) | |
tree | 6d25159b083afc51b38f003ae87974eb795b06a0 /runner/testdata | |
parent | 18c1e7525591b98b53321c26464f3181a5f7cce1 (diff) |
runner: Unit tests for the runner
TODO: Unit tests for the results.json file contents.
v2:
- Avoid writing the nul character to mock files
- Properly set up tmpdirs
v3:
- Restore the resume-related changes that were lost in rebase
v4:
- Better teardown for temporary directories
- Build with autotools
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner/testdata')
-rw-r--r-- | runner/testdata/Makefile.am | 25 | ||||
-rw-r--r-- | runner/testdata/meson.build | 20 | ||||
-rw-r--r-- | runner/testdata/no-subtests.c | 6 | ||||
-rw-r--r-- | runner/testdata/skippers.c | 14 | ||||
-rw-r--r-- | runner/testdata/successtest.c | 10 |
5 files changed, 75 insertions, 0 deletions
diff --git a/runner/testdata/Makefile.am b/runner/testdata/Makefile.am new file mode 100644 index 00000000..fe225d8d --- /dev/null +++ b/runner/testdata/Makefile.am @@ -0,0 +1,25 @@ +testdata_progs = no-subtests skippers successtest + +noinst_PROGRAMS = $(testdata_progs) + +test-list.txt: Makefile + @echo TESTLIST > $@ + @echo ${testdata_progs} >> $@ + @echo END TESTLIST >> $@ + +noinst_DATA = test-list.txt + +all-local: .gitignore +.gitignore: Makefile.am + @echo "$(testdata_progs) test-list.txt /.gitignore" | sed 's/\s\+/\n/g' | sort > $@ + +CLEANFILES = test-list.txt .gitignore + +AM_CFLAGS = $(CWARNFLAGS) -Wno-unused-result $(DEBUG_CFLAGS) \ + -I$(top_srcdir)/include/drm-uapi \ + -I$(srcdir)/../.. \ + -I$(srcdir)/../../lib \ + $(DRM_CFLAGS) $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) \ + -D_GNU_SOURCE + +LDADD = $(top_builddir)/lib/libintel_tools.la diff --git a/runner/testdata/meson.build b/runner/testdata/meson.build new file mode 100644 index 00000000..011eff8e --- /dev/null +++ b/runner/testdata/meson.build @@ -0,0 +1,20 @@ + +testdata_progs = [ 'successtest', + 'no-subtests', + 'skippers', + ] + +testdata_executables = [] + +foreach prog : testdata_progs + testdata_executables += executable(prog, prog + '.c', + dependencies : igt_deps, + install : false) +endforeach + +testdata_list = custom_target('testdata_testlist', + output : 'test-list.txt', + command : [ gen_testlist, '@OUTPUT@', testdata_progs ], + build_by_default : true) + +testdata_dir = meson.current_build_dir() diff --git a/runner/testdata/no-subtests.c b/runner/testdata/no-subtests.c new file mode 100644 index 00000000..00c92e25 --- /dev/null +++ b/runner/testdata/no-subtests.c @@ -0,0 +1,6 @@ +#include "igt.h" + +igt_simple_main +{ + +} diff --git a/runner/testdata/skippers.c b/runner/testdata/skippers.c new file mode 100644 index 00000000..be4a31b4 --- /dev/null +++ b/runner/testdata/skippers.c @@ -0,0 +1,14 @@ +#include "igt.h" + +igt_main +{ + igt_fixture { + igt_require_f(false, "Skipping from fixture\n"); + } + + igt_subtest("skip-one") + igt_debug("Should be skipped\n"); + + igt_subtest("skip-two") + igt_debug("Should be skipped\n"); +} diff --git a/runner/testdata/successtest.c b/runner/testdata/successtest.c new file mode 100644 index 00000000..bb411eb4 --- /dev/null +++ b/runner/testdata/successtest.c @@ -0,0 +1,10 @@ +#include "igt.h" + +igt_main +{ + igt_subtest("first-subtest") + igt_debug("Running first subtest\n"); + + igt_subtest("second-subtest") + igt_debug("Running second subtest\n"); +} |