[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XTF-ARM] tests: Hypercall xen_version testing
Add a new test hyp-xen-version to perform functional testing of xen_version hypercall. Check the following commands (more can be added later on): - XENVER_version, - XENVER_extraversion, - XENVER_compile_info, - XENVER_changeset - XENVER_get_features, - passing invalid command. For now, enable this test only for arm64. Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx> --- This is a patch for XTF fork https://gitlab.com/xen-project/fusa/xtf (branch xtf-arm) under which XTF on Arm port is maintained. Pushed to xen-devel together with patches to Xen CI automation, so that it is clear what the test is doing. --- build/arm64/arch-tests.mk | 2 +- docs/all-tests.dox | 2 + tests/hyp-xen-version/Makefile | 10 ++++ tests/hyp-xen-version/main.c | 105 +++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 tests/hyp-xen-version/Makefile create mode 100644 tests/hyp-xen-version/main.c diff --git a/build/arm64/arch-tests.mk b/build/arm64/arch-tests.mk index 1a13ba923625..c85e28bbea9e 100644 --- a/build/arm64/arch-tests.mk +++ b/build/arm64/arch-tests.mk @@ -1,4 +1,4 @@ # Supported tests by arm64 -# Currently only example test is supported TESTS := $(ROOT)/tests/example +TESTS += $(ROOT)/tests/hyp-xen-version diff --git a/docs/all-tests.dox b/docs/all-tests.dox index 322f078db09e..48a407593463 100644 --- a/docs/all-tests.dox +++ b/docs/all-tests.dox @@ -20,6 +20,8 @@ and functionality. @subpage test-fpu-exception-emulation - FPU Exception Emulation. Covers XSA-190. +@subpage test-hyp-xen-version - Hypercall xen_version testing. + @subpage test-invlpg - `invlpg` instruction behaviour. @subpage test-lbr-tsx-vmentry - Haswell and later LBR/TSX Vmentry failure test. diff --git a/tests/hyp-xen-version/Makefile b/tests/hyp-xen-version/Makefile new file mode 100644 index 000000000000..2d7db8fa6ad9 --- /dev/null +++ b/tests/hyp-xen-version/Makefile @@ -0,0 +1,10 @@ +include $(ROOT)/build/common.mk + +NAME := hyp-xen-version +CATEGORY := functional +TEST-ARCH := arm64 +TEST-ENVS := $(ALL_ENVIRONMENTS) + +obj-perenv += main.o + +include $(ROOT)/build/gen.mk diff --git a/tests/hyp-xen-version/main.c b/tests/hyp-xen-version/main.c new file mode 100644 index 000000000000..bda591ca5c29 --- /dev/null +++ b/tests/hyp-xen-version/main.c @@ -0,0 +1,105 @@ +/** + * @file tests/hyp-xen-version/main.c + * @ref test-hyp-xen-version + * + * @page test-hyp-xen-version Hypercall xen_version + * + * Functional testing of xen_version hypercall. + * + * @see tests/hyp-xen-version/main.c + */ +#include <xtf.h> + +const char test_title[] = "Hypercall xen_version testing"; + +#define INVALID_CMD -1 + +void test_main(void) +{ + int ret; + + printk("Checking XENVER_version:\n"); + { + /* + * Version is returned directly in format: ((major << 16) | minor), + * so no need to check the return value for an error. + */ + ret = hypercall_xen_version(XENVER_version, NULL); + printk(" version: %u.%u\n", ret >> 16, ret & 0xFFFF); + } + + printk("Checking XENVER_extraversion:\n"); + { + xen_extraversion_t xen_ev; + memset(&xen_ev, 0, sizeof(xen_ev)); + + ret = hypercall_xen_version(XENVER_extraversion, xen_ev); + if ( ret < 0 ) + return xtf_error("Error %d\n", ret); + + printk(" extraversion: %s\n", xen_ev); + } + + printk("Checking XENVER_compile_info:\n"); + { + xen_compile_info_t xen_ci; + memset(&xen_ci, 0, sizeof(xen_ci)); + + ret = hypercall_xen_version(XENVER_compile_info, &xen_ci); + if ( ret < 0 ) + return xtf_error("Error %d\n", ret); + + printk(" compiler: %s\n", xen_ci.compiler); + printk(" compile_by: %s\n", xen_ci.compile_by); + printk(" compile_domain: %s\n", xen_ci.compile_domain); + printk(" compile_date: %s\n", xen_ci.compile_date); + } + + printk("Checking XENVER_changeset:\n"); + { + xen_changeset_info_t xen_cs; + memset(&xen_cs, 0, sizeof(xen_cs)); + + ret = hypercall_xen_version(XENVER_changeset, &xen_cs); + if ( ret < 0 ) + return xtf_error("Error %d\n", ret); + + printk(" changeset: %s\n", xen_cs); + } + + printk("Checking XENVER_get_features:\n"); + { + for ( unsigned int i = 0; i < XENFEAT_NR_SUBMAPS; i++ ) + { + xen_feature_info_t xen_fi = { .submap_idx = i }; + + ret = hypercall_xen_version(XENVER_get_features, &xen_fi); + if ( ret < 0 ) + return xtf_error("Error %d for submap[%u]\n", ret, i); + + printk(" submap[%u]: %#x\n", i, xen_fi.submap); + } + } + + printk("Checking invalid command:\n"); + { + /* Invalid cmd should result in returning -ENOSYS. */ + ret = hypercall_xen_version(INVALID_CMD, NULL); + if ( ret != -ENOSYS ) + return xtf_error("Error %d\n", ret); + + printk(" ok\n"); + } + + xtf_success(NULL); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ -- 2.25.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |