test-info.json will accumulate relevant test metadata.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
.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
PREFIX ?= $(ROOT)
CC = gcc
+ALL_CATEGORIES := special functional
+
ALL_ENVIRONMENTS := pv64 pv32pae hvm64 hvm32pae hvm32
PV_ENVIRONMENTS := $(filter pv%,$(ALL_ENVIRONMENTS))
$(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
--- /dev/null
+#!/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"
+ )
- 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:
include $(ROOT)/build/common.mk
NAME := example
+CATEGORY := special
TEST-ENVS := $(ALL_ENVIRONMENTS)
obj-perenv += main.o
include $(ROOT)/build/common.mk
NAME := selftest
+CATEGORY := special
TEST-ENVS := $(ALL_ENVIRONMENTS)
obj-perenv += main.o
include $(ROOT)/build/common.mk
NAME := swint-emulation
+CATEGORY := functional
TEST-ENVS := $(HVM_ENVIRONMENTS)
obj-perenv += main.o lowlevel.o