]> xenbits.xensource.com Git - xtf.git/commitdiff
Print test titles earlier during startup
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 17 Nov 2016 17:21:35 +0000 (17:21 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 17 Nov 2016 19:00:45 +0000 (19:00 +0000)
Certain conditions, such as failing the test_needs_fep check, result in the
framework exiting before calling test_main().  Logs from such runs are
impossible to distinguish.

Require tests to provide a test_title string, and print it as part of the
startup banner.

Update make-new-test.sh and the introductory docs to match

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
24 files changed:
common/setup.c
docs/introduction.dox
include/xtf/test.h
make-new-test.sh
tests/cpuid-faulting/main.c
tests/cpuid/main.c
tests/example/main.c
tests/fep/main.c
tests/fpu-exception-emulation/main.c
tests/invlpg/main.c
tests/msr/main.c
tests/pv-iopl/main.c
tests/selftest/main.c
tests/swint-emulation/main.c
tests/xsa-122/main.c
tests/xsa-123/main.c
tests/xsa-167/main.c
tests/xsa-168/main.c
tests/xsa-173/main.c
tests/xsa-182/main.c
tests/xsa-183/main.c
tests/xsa-185/main.c
tests/xsa-186/main.c
tests/xsa-188/main.c

index 3c2f848cf64d942f40c67b35c6f7efd2b7dba1c7..9d70435c59026e79ba60e4d74dc1afef3bd9aafd 100644 (file)
@@ -23,6 +23,7 @@ void __noreturn xtf_main(void)
 
     printk("--- Xen Test Framework ---\n");
     printk("Environment: %s\n", environment_description);
+    printk("%s\n", test_title);
 
     test_setup();
 
index 3352dae3be56b1c411dbb142fe57d57ccc8cb088..341702e65d662bb15a53bee663823d27ec96264f 100644 (file)
@@ -84,6 +84,10 @@ The minimum for main.c is to include the framework:
 
 @skipline <xtf.h>
 
+Choose a suitable title:
+
+@skipline const char test_title
+
 Implement test_main():
 
 @skipline main(
index 778090cfecb0fe3158388ed96df8da1601101f96..1584e5054693fcc1f1b0fc6a72d2134cea39cd8e 100644 (file)
  */
 void test_main(void);
 
+/**
+ * The title of the test.
+ */
+extern const char test_title[];
+
 /**
  * Boolean indicating whether generic Force Emulation Prefix support is
  * available for the test to use.
index 035eda8136e4cb5a16a6b9f8ea6cc09a6b2fa6a5..5f21ef5794f3fe382547577fa26bbce3e0b937ab 100755 (executable)
@@ -114,14 +114,14 @@ cat <<EOF
  */
 #include <xtf.h>
 
-void test_main(void)
-{
 EOF
 [ $CATEGORY != "xsa" ] && \
-    echo '    printk("Test '$NAME'\\n");' || \
-    echo '    printk("'$NAME_UC' PoC\\n");'
+    echo 'const char test_title[] = "Test '$NAME'";' || \
+    echo 'const char test_title[] = "'$NAME_UC' PoC";'
 cat <<EOF
 
+void test_main(void)
+{
     xtf_success(NULL);
 }
 
index be0d40a9d3a8dede0003fe14fa5d31be2b55b5ef..40136f6e30ed765bf1e08c0ebcd11f52120b0dff 100644 (file)
@@ -25,6 +25,8 @@
 #include <arch/x86/msr-index.h>
 #include <arch/x86/processor.h>
 
+const char test_title[] = "Guest CPUID Faulting support";
+
 bool test_wants_user_mappings = true;
 
 unsigned long stub_cpuid(void)
@@ -88,8 +90,6 @@ void test_main(void)
 {
     uint64_t platform_info, features_enable;
 
-    printk("Guest CPUID Faulting support\n");
-
     if ( IS_DEFINED(CONFIG_HVM) && !xtf_has_fep )
         xtf_skip("FEP support not detected - some tests will be skipped\n");
 
index db638d1a11d8c84c5d1751b84abcc49527a41088..61814d08e37bc31e44da756aeeed8f2a86d4d214 100644 (file)
@@ -11,6 +11,8 @@
  */
 #include <xtf.h>
 
+const char test_title[] = "Guest cpuid information";
+
 static void dump_leaves(cpuid_count_fn_t cpuid_fn)
 {
     uint32_t leaf = 0, subleaf = ~0U;
@@ -134,8 +136,6 @@ static void dump_leaves(cpuid_count_fn_t cpuid_fn)
 
 void test_main(void)
 {
-    printk("Guest cpuid information\n");
-
     printk("Native cpuid:\n");
     dump_leaves(cpuid_count);
 
index 50ec6979239f114bcba5842941b516470881cea3..32422f1439bf498fb0c7468dc7e1906da9c6d85e 100644 (file)
  */
 #include <xtf.h>
 
+const char test_title[] = "Hello World";
+
 void test_main(void)
 {
-    xtf_success("Hello World\n");
+    xtf_success(NULL);
 }
 
 /*
index 7bfee374991d22b8757734c01bdb818cb3caea7f..d34d997151bcdc6e2db0ec6c9b3a207b8d854c4d 100644 (file)
  */
 #include <xtf.h>
 
+const char test_title[] = "Test availability of HVM forced emulation prefix";
+
 void test_main(void)
 {
-    printk("Test availability of HVM forced emulation prefix\n");
-
     if ( xtf_has_fep )
         xtf_success(NULL);
     else
index a2d37a25b864225eeda5e57e0d500d6ad0e4341f..5ba37e2f0e4678cfa3afd4b2438ea6c4fe7df4a4 100644 (file)
@@ -41,6 +41,8 @@
 #include <arch/x86/processor.h>
 #include <arch/x86/symbolic-const.h>
 
+const char test_title[] = "FPU Exception Emulation";
+
 #define CR0_SYM(...) TOK_OR(X86_CR0_, ##__VA_ARGS__)
 #define CR0_MASK CR0_SYM(EM, MP, TS)
 
@@ -232,8 +234,6 @@ void run_tests(bool force)
 
 void test_main(void)
 {
-    printk("FPU Exception Emulation:\n");
-
     default_cr0 = read_cr0();
 
     run_tests(false);
index ba253709817ca3737d16f6acdb13ba1a8de34fcd..09e8954e07052c85bedf12229a32bc0d5846c444 100644 (file)
@@ -87,6 +87,8 @@
 #include <arch/x86/msr-index.h>
 #include <arch/x86/symbolic-const.h>
 
+const char test_title[] = "Invlpg tests";
+
 /* Swizzle to easily change all invlpg instructions to being emulated. */
 #if 0
 #define _ASM_MAYBE_XEN_FEP _ASM_XEN_FEP
index e16f5707ba9982fca3791d999c6077d5636f2d6c..fcfe03327e6818bf5a944abb0268d04971153dd3 100644 (file)
  */
 #include <xtf.h>
 
+const char test_title[] = "Guest MSR information";
+
 void test_main(void)
 {
     unsigned int idx = 0;
     uint64_t val;
 
-    printk("Guest MSR information\n");
-
     do {
         if ( !rdmsr_safe(idx, &val) )
             printk("  %08x -> %016"PRIx64"\n", idx, val);
index 1b620c1e10d2df61fcb3c584d5d0c2832d9c46fc..128e495bbe1435c0142fa03c775cb8daec5f0fa1 100644 (file)
@@ -42,6 +42,8 @@
 
 #include <arch/x86/processor.h>
 
+const char test_title[] = "PV IOPL emulation";
+
 bool test_wants_user_mappings = true;
 
 /**
@@ -248,8 +250,6 @@ void test_main(void)
 {
     const struct test *test;
 
-    printk("PV IOPL emulation\n");
-
     /**
      * @todo Implement better command line infrastructure, but this will do
      * for now.
index 84aa6376f0dc9d8892db4ee3e6f1b0a02a12f79b..2b19f212e3c16e4b2a71533fc87996e2b6377ac3 100644 (file)
@@ -15,6 +15,8 @@
 #include <arch/x86/processor.h>
 #include <arch/x86/segment.h>
 
+const char test_title[] = "XTF Selftests";
+
 bool test_wants_user_mappings = true;
 
 static void test_int3_breakpoint(void)
@@ -291,8 +293,6 @@ static void test_custom_idte(void)
 
 void test_main(void)
 {
-    printk("XTF Selftests\n");
-
     test_int3_breakpoint();
     test_extable();
     test_exlog();
index 34adf1723fa37f4b6a4beae80f27534df6265a06..c7c932729ff09a065dbdf2cc9ff57141e0670800 100644 (file)
@@ -51,6 +51,8 @@
 
 #include "lowlevel.h"
 
+const char test_title[] = "Software interrupt emulation";
+
 bool test_wants_user_mappings = true;
 
 /** Single stub's worth of information. */
@@ -368,8 +370,6 @@ void cpl0_tests(void)
 
 void test_main(void)
 {
-    printk("Trap emulation\n");
-
     /*
      * Even if FEP is unavailable, run the tests against real hardware to
      * check the algorithm, but don't claim overall success.
index 13ac6d4daba985e1eb426fccf95db9502109bea6..39987e06be61db303f1d4c22d09a1d05649f078e 100644 (file)
@@ -22,6 +22,8 @@
  */
 #include <xtf.h>
 
+const char test_title[] = "XSA-122 PoC";
+
 /*
  * Check a buffer of a specified size for non-NUL bytes following the string
  * NUL terminator.
@@ -48,8 +50,6 @@ void test_main(void)
 {
     long rc;
 
-    printk("XSA-122 PoC\n");
-
     printk("XENVER_extraversion:\n");
     {
         xen_extraversion_t extra;
index 7ed387626a8c69f23b3a845dfe0654ea5189eae4..92e3055af0b9c0a1eda079fc0c76c25b8e98281f 100644 (file)
  */
 #include <xtf.h>
 
+const char test_title[] = "XSA-123 PoC";
+
 bool test_needs_fep = true;
 
 void test_main(void)
 {
     unsigned long src = 0x1234, dest = 0;
 
-    printk("XSA-123 PoC\n");
-
     asm volatile(_ASM_XEN_FEP
                  /* Explicit %cs segment override. */
                  ".byte 0x2e;"
index 893adaf15ac928440c7fcd1e916901754c509df0..52664cb70b29d9091eb9591aa66a2084d230cb27 100644 (file)
  */
 #include <xtf.h>
 
+const char test_title[] = "XSA-167 PoC";
+
 void test_main(void)
 {
-    printk("XSA-167 PoC\n");
-
     mmuext_op_t op =
     {
         .cmd = MMUEXT_MARK_SUPER,
index a330f47e67dff80124bd9280aae35e4560f987f2..d6d12506c1103704ffcd46e5084c3a0eb2fa4d42 100644 (file)
  */
 #include <xtf.h>
 
+const char test_title[] = "XSA-168 PoC";
+
 void test_main(void)
 {
-    printk("XSA-168 PoC\n");
-
     /**
      * At the time of writing, Xen doesn't correctly handle `invlpg` while
      * running in shadow mode on AMD Gen1 hardware lacking decode assistance.
index 386c3fdf7992c1a2bc36fc4edb76c28aa7798002..7e53a49fd502be0a741b22360a3c4189edff4e32 100644 (file)
@@ -26,6 +26,8 @@
 #include <arch/x86/processor.h>
 #include <arch/x86/symbolic-const.h>
 
+const char test_title[] = "XSA-173 PoC";
+
 /* New L2 pagetable for the test to manipulate. */
 uint64_t nl2[PAE_L2_PT_ENTRIES] __aligned(PAGE_SIZE);
 
@@ -50,8 +52,6 @@ void test_main(void)
 {
     uint64_t *ptr, val;
 
-    printk("XSA-173 PoC\n");
-
     /* Hook nl2 into the existing l3, just above the 4GB boundary. */
     pae_l3_identmap[4] = pte_from_virt(nl2, PF_SYM(U, RW, P));
 
index 1e889d139bdf1fbd8585995048365aa202fad4dc..c14bc2182564fe7b1ec5e607413ea986725eceee 100644 (file)
 #include <arch/x86/pagetable.h>
 #include <arch/x86/symbolic-const.h>
 
+const char test_title[] = "XSA-182 PoC";
+
 void test_main(void)
 {
-    printk("XSA-182 PoC\n");
-
     unsigned long cr3 = read_cr3();
     intpte_t nl1e = pte_from_paddr(cr3, PF_SYM(AD, U, P));
     intpte_t *l4 = _p(KB(4));
index e016c911aa9fc74c796cb0c0f0b618a9f5550f96..b6fdeb7c1eca4bd47423bd74259657e3982ba866 100644 (file)
@@ -40,6 +40,8 @@
 #include <arch/x86/pagetable.h>
 #include <arch/x86/symbolic-const.h>
 
+const char test_title[] = "XSA-183 PoC";
+
 uint8_t user_stack[PAGE_SIZE] __aligned(PAGE_SIZE);
 
 void test_main(void)
@@ -47,8 +49,6 @@ void test_main(void)
     unsigned long curr_stk, discard;
     intpte_t nl1e = pte_from_virt(user_stack, PF_SYM(AD, U, RW, P));
 
-    printk("XSA-183 PoC\n");
-
     /* Remap user_stack with _PAGE_USER. */
     if ( hypercall_update_va_mapping(user_stack, nl1e, UVMF_INVLPG) )
         panic("Unable to remap user_stack with _PAGE_USER\n");
index fe8c39e22c07086e2a06165823f5727007c25e76..65832994bcbe0d2fe471926439f1bd0f7905f308 100644 (file)
 #include <arch/x86/pagetable.h>
 #include <arch/x86/symbolic-const.h>
 
+const char test_title[] = "XSA-185 PoC";
+
 void test_main(void)
 {
-    printk("XSA-185 PoC\n");
-
     paddr_t cr3_paddr = (paddr_t)xen_cr3_to_pfn(read_cr3()) << PAGE_SHIFT;
 
      /*
index fe7e98b79a69ce6518d2c6f840b29ca05b036ab0..a008b78723de124a2134efe259b90fa41ae20e71 100644 (file)
@@ -36,6 +36,8 @@
 #include <arch/x86/pagetable.h>
 #include <arch/x86/symbolic-const.h>
 
+const char test_title[] = "XSA-186 PoC";
+
 bool test_needs_fep = true;
 
 /* Test-local `int` handler. */
@@ -77,8 +79,6 @@ bool ex_fault(struct cpu_regs *regs, const struct extable_entry *ex)
 
 void test_main(void)
 {
-    printk("XSA-186 PoC\n");
-
     struct xtf_idte idte =
     {
         .addr = (unsigned long)test_int_handler,
index 1d4afbff64be024c4b783bc9e84984e7636d7462..7d659073b9a3aa453b10f90415df13b97e8ee817 100644 (file)
@@ -18,6 +18,8 @@
 #include <xtf.h>
 #include <arch/x86/mm.h>
 
+const char test_title[] = "XSA-188 PoC";
+
 static uint8_t array_page[PAGE_SIZE] __aligned(PAGE_SIZE);
 
 void test_main(void)
@@ -26,8 +28,6 @@ void test_main(void)
     struct evtchn_expand_array expand_array;
     int ret;
 
-    printk("XSA-188 PoC\n");
-
     /* 1. EVTCHNOP_init_control with bad GFN. */
     init_control.control_gfn = (uint64_t)-2;
     init_control.offset = 0;