about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2020-12-22 21:02:14 +0000
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2021-04-20 11:42:23 +0100
commit458e3f9ec4f8d5d2711a0aeff7a532b184e7d075 (patch)
tree623f70ba3341e7d611e62120d995575a4d849869 /test
parent126387bc7921e892d4a5b75a8874242527cc8111 (diff)
downloadklee-458e3f9ec4f8d5d2711a0aeff7a532b184e7d075.tar.gz
Test for -max-static-fork-pct
Diffstat (limited to 'test')
-rw-r--r--test/Feature/MaxStaticForkPct.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/Feature/MaxStaticForkPct.c b/test/Feature/MaxStaticForkPct.c
new file mode 100644
index 00000000..8ea5c674
--- /dev/null
+++ b/test/Feature/MaxStaticForkPct.c
@@ -0,0 +1,43 @@
+// RUN: %clang %s -emit-llvm %O0opt -c -g -o %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee -max-static-fork-pct=0.2 -max-static-pct-check-delay=0s --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck --check-prefix=CHECK-pt2 %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee -max-static-fork-pct=0.5 -max-static-pct-check-delay=0s --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck --check-prefix=CHECK-pt5 %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee -max-static-fork-pct=0.8 -max-static-pct-check-delay=0s --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck --check-prefix=CHECK-pt8 %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee -max-static-cpfork-pct=0.5 -max-static-pct-check-delay=0s --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck --check-prefix=CHECK-cppt5 %s
+
+#include "klee/klee.h"
+#include <stdio.h>
+
+int main() {
+#define N 4
+  int x[10], i;
+  klee_make_symbolic(&x, sizeof(x), "x");
+
+  if (x[0])
+      printf("x[0] ");
+  else printf("NOT x[0] ");
+
+  if (x[1])
+  // CHECK-pt2: skipping fork and concretizing condition (MaxStatic*Pct limit reached)
+  // CHECK-cppt5: skipping fork and concretizing condition (MaxStatic*Pct limit reached)
+      printf("x[1] ");
+  else printf("NOT x[1] ");
+
+  for (i = 2; i < 10; i++) {
+    if (x[i])
+    // CHECK-pt5: skipping fork and concretizing condition (MaxStatic*Pct limit reached)
+    // CHECK-pt8: skipping fork and concretizing condition (MaxStatic*Pct limit reached)
+      printf("x[%d] ", i);
+    else printf("NOT x[%d] ", i);
+  }
+
+  // CHECK-pt2: completed paths = 4
+  // CHECK-pt5: completed paths = 8
+  // CHECK-pt8: completed paths = 17
+
+  // CHECK-cppt5: completed paths = 2
+  return 0;
+}