]> rtime.felk.cvut.cz Git - hercules2020/jailhouse-build.git/commitdiff
memguard-test: Add wvtest protocol support
authorMichal Sojka <michal.sojka@cvut.cz>
Thu, 1 Nov 2018 13:23:30 +0000 (14:23 +0100)
committerMichal Sojka <michal.sojka@cvut.cz>
Thu, 1 Nov 2018 13:23:30 +0000 (14:23 +0100)
test/memguard-test.c

index 426e71bfc47e669d2f6b7fd23e256e30b17f0309..82385246b0bd9e2c5b1eefd1865acf0bd0327668 100644 (file)
@@ -127,6 +127,13 @@ static void print_test_info(uint64_t timeout_us, uint64_t mem_budget, uint64_t f
               r.mem, r.mem_ovf ? '!' : ' ');
 }
 
+void wvtest_pass(bool cond, const char* str)
+{
+       printf("! %s %s\n", str, cond ? "ok" : "FAILURE");
+}
+
+#define WVPASS(cond) wvtest_pass(cond, #cond)
+
 #define MGTEST(timeout_us, mem_budget, flags, code)                            \
        ({                                                                     \
                long retval;                                                   \
@@ -155,9 +162,12 @@ int main(int argc, char *argv[])
                err(1, "sched_setaffinity");
        printf("Pinned to CPU %d\n", cpu);
 
+       struct mg_ret r;
        for (uint64_t flags = 0; flags < 4; flags++) {
                compute_kernel(1); /* warm up */
-               MGTEST(5000, 10000, flags, compute_kernel(1000));
+               r = MGTEST(5000, 10000, flags, compute_kernel(1000));
+               WVPASS(!r.mem_ovf);
+               WVPASS(r.time > 900);
                MGTEST(500, 10000, flags, compute_kernel(1000));
                MGTEST(5000, 10000, flags, compute_kernel(2000));
                MGTEST(500, 10000, flags, compute_kernel(2000));