]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Introduce test categories and create a test-info.json for each test
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 22 Feb 2016 12:43:51 +0000 (12:43 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 22 Feb 2016 13:50:10 +0000 (13:50 +0000)
test-info.json will accumulate relevant test metadata.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Makefile
build/common.mk
build/gen.mk
build/mkinfo.py [new file with mode: 0644]
docs/mainpage.dox
tests/example/Makefile
tests/selftest/Makefile
tests/swint-emulation/Makefile

index 54cf8e1c4eef1e5df23f956295bd05312e774a60..7657e194c9e61b7e4fc23d0be10ae3d3a4da9c51 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,8 @@ cscope:
 .PHONY: clean
 clean:
        find . \( -name "*.o" -o -name "*.d" -o -name "*.lds" \) -delete
-       find tests/ \( -executable -name "test-*" -o -name "test-*.cfg" \) -delete
+       find tests/ \( -executable -name "test-*" -o -name "test-*.cfg" \
+               -o -name "test-info.json" \) -delete
 
 .PHONY: distclean
 distclean: clean
index 6971cd1a684c04c700ef2c94f8eeb0d9ffccddcb..227e909ba97e2e28559596c015b1c76f8e5501d5 100644 (file)
@@ -3,6 +3,8 @@ DESTDIR ?= $(ROOT)/dist
 PREFIX ?= $(ROOT)
 CC = gcc
 
+ALL_CATEGORIES     := special functional
+
 ALL_ENVIRONMENTS   := pv64 pv32pae hvm64 hvm32pae hvm32
 
 PV_ENVIRONMENTS    := $(filter pv%,$(ALL_ENVIRONMENTS))
index 5d8170cf9345edc3681bb621dbb66fb68d240f5e..a7b759d044902aa57c64a88025e9637563ac1e57 100644 (file)
@@ -13,11 +13,26 @@ ifneq ($(filter-out $(ALL_ENVIRONMENTS),$(TEST-ENVS)),)
 $(error Unrecognised environments '$(filter-out $(ALL_ENVIRONMENTS),$(TEST-ENVS))')
 endif
 
+ifeq ($(CATEGORY),)
+$(error CATEGORY should not be empty)
+endif
+
+ifneq ($(filter-out $(ALL_CATEGORIES),$(CATEGORY)),)
+$(error Unrecognised category '$(filter-out $(ALL_CATEGORIES),$(CATEGORY))')
+endif
+
 .PHONY: build
 build: $(foreach env,$(TEST-ENVS),test-$(env)-$(NAME) test-$(env)-$(NAME).cfg)
+build: test-info.json
+
+test-info.json: $(ROOT)/build/mkinfo.py FORCE
+       @python $< $@.tmp "$(NAME)" "$(CATEGORY)" "$(TEST-ENVS)"
+       @if ! cmp -s $@ $@.tmp; then mv -f $@.tmp $@; else rm -f $@.tmp; fi
 
 .PHONY: install install-each-env
-install: install-each-env
+install: install-each-env test-info.json
+       @mkdir -p $(DESTDIR)/tests/$(NAME)
+       install -m664 -p test-info.json $(DESTDIR)/tests/$(NAME)
 
 define PERENV_build
 
diff --git a/build/mkinfo.py b/build/mkinfo.py
new file mode 100644 (file)
index 0000000..4b4dc22
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import sys, os, json
+
+template = {
+    "name": sys.argv[2],
+    "category": sys.argv[3],
+    "environments": sys.argv[4].split(" "),
+    }
+
+open(sys.argv[1], "w").write(
+    json.dumps(template, indent=4, separators=(',', ': '))
+    + "\n"
+    )
index ddc8995152abb747aa1163ea9496c74e7283430e..a44f5367d2f67c2edf1d3ecaba59e9521d758ead 100644 (file)
@@ -35,6 +35,7 @@ Requirements:
 - GNU Make >= 3.81
 - GNU comaptible toolchain, capable of `-std=gnu99`, `-m64`, and `-m32`
     - Clang may be used, via `CC="clang -no-integrated-as"`
+- Python
 
 To obtain and build:
 
index e4878bc7ae97e71862fa89ce5df89a54dbd1009c..872769deb171a2cbeb46d553597cf8d3809e28e7 100644 (file)
@@ -4,6 +4,7 @@ ROOT := $(abspath $(CURDIR)/../..)
 include $(ROOT)/build/common.mk
 
 NAME      := example
+CATEGORY  := special
 TEST-ENVS := $(ALL_ENVIRONMENTS)
 
 obj-perenv += main.o
index 22079fb1c8c78e0a77afd4653cd515ab1ef7eb35..fc249d7656d0ab72dc304ad98e294f13944b55ed 100644 (file)
@@ -4,6 +4,7 @@ ROOT := $(abspath $(CURDIR)/../..)
 include $(ROOT)/build/common.mk
 
 NAME      := selftest
+CATEGORY  := special
 TEST-ENVS := $(ALL_ENVIRONMENTS)
 
 obj-perenv += main.o
index 59a3226714886fc8b14f5f6499baaed19c4561db..246afb3ad3984f43f562a59b131beae2a9b1664c 100644 (file)
@@ -4,6 +4,7 @@ ROOT := $(abspath $(CURDIR)/../..)
 include $(ROOT)/build/common.mk
 
 NAME      := swint-emulation
+CATEGORY  := functional
 TEST-ENVS := $(HVM_ENVIRONMENTS)
 
 obj-perenv += main.o lowlevel.o