summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/all11
-rw-r--r--test/eviction.c17
-rw-r--r--test/kvm-eviction.c17
3 files changed, 35 insertions, 10 deletions
diff --git a/test/all b/test/all
new file mode 100755
index 0000000..1c3abf2
--- /dev/null
+++ b/test/all
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+mkdir -p logs
+
+set -ex
+
+./test/eviction &> logs/eviction
+./test/kvm-eviction &> logs/kvm-eviction
+./test/kvm-pagestep &> logs/kvm-pagestep
+./test/kvm-step &> logs/kvm-step
+./test/kvm-targetstep &> logs/kvm-targetstep
diff --git a/test/eviction.c b/test/eviction.c
index fc11630..ca404b9 100644
--- a/test/eviction.c
+++ b/test/eviction.c
@@ -14,7 +14,7 @@ int
main(int argc, const char **argv)
{
uint8_t counts[L1_SETS];
- uint32_t set;
+ uint32_t arg, set;
int fd, ret;
fd = open("/dev/kvm", O_RDONLY);
@@ -22,18 +22,23 @@ main(int argc, const char **argv)
set = 48;
if (argc > 1) set = atoi(argv[1]);
- if (set >= L1_SETS)
- errx(1, "set out-of-bounds");
+ if (set >= L1_SETS) errx(1, "set out-of-bounds");
- ret = ioctl(fd, KVM_CPC_TEST_EVICTION, &set);
- if (ret == -1) err(1, "ioctl KVM_CPC_TEST_EVICTION");
+ ret = ioctl(fd, KVM_CPC_RESET, &arg);
+ if (ret == -1) err(1, "KVM_CPC_RESET");
+
+ arg = set;
+ ret = ioctl(fd, KVM_CPC_TEST_EVICTION, &arg);
+ if (ret == -1) err(1, "KVM_CPC_TEST_EVICTION");
ret = ioctl(fd, KVM_CPC_READ_COUNTS, counts);
- if (ret == -1) err(1, "ioctl KVM_CPC_READ_COUNTS");
+ if (ret == -1) err(1, "KVM_CPC_READ_COUNTS");
print_counts(counts);
printf("\n");
print_counts_raw(counts);
close(fd);
+
+ return arg;
}
diff --git a/test/kvm-eviction.c b/test/kvm-eviction.c
index 297c9da..ceb1abd 100644
--- a/test/kvm-eviction.c
+++ b/test/kvm-eviction.c
@@ -43,7 +43,7 @@ main(int argc, const char **argv)
uint8_t counts[2][SAMPLE_COUNT][L1_SETS];
uint8_t baseline[L1_SETS];
struct cpc_track_cfg cfg;
- int i, k, ret;
+ int i, k, ret, exitcode;
vmtype = "kvm";
if (argc > 1) vmtype = argv[1];
@@ -126,26 +126,35 @@ main(int argc, const char **argv)
}
/* check for measurment errors */
+ exitcode = 0;
for (i = 0; i < SAMPLE_COUNT; i++) {
for (k = 0; k < L1_SETS; k++) {
- if (counts[WITH][i][k] + baseline[k] > L1_ASSOC)
+ if (counts[WITH][i][k] + baseline[k] > L1_ASSOC) {
warnx("sample %i: With count OOB for set %i (=%i)",
i, k, counts[WITH][i][k] + baseline[k]);
+ exitcode = 1;
+ }
- if (counts[WITHOUT][i][k] + baseline[k] > L1_ASSOC)
+ if (counts[WITHOUT][i][k] + baseline[k] > L1_ASSOC) {
warnx("sample %i: Without count OOB for set %i (=%i)",
i, k, counts[WITHOUT][i][k] + baseline[k]);
+ exitcode = 1;
+ }
}
- if (!counts[WITH][i][TARGET_SET])
+ if (!counts[WITH][i][TARGET_SET]) {
warnx("sample %i: Missing eviction in target set %i (=%i,%i)",
i, TARGET_SET, counts[WITH][i][TARGET_SET],
counts[WITH][i][TARGET_SET] + baseline[TARGET_SET]);
+ exitcode = 1;
+ }
}
vm_deinit(&vms[WITH]);
vm_deinit(&vms[WITHOUT]);
kvm_setup_deinit();
+
+ return exitcode;
}