about summary refs log tree commit diff homepage
path: root/test/Feature/LoggingInstructions.c
blob: 049aa9da95d27e3389ba32c03082d95955b393ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// RUN: %llvmgcc %s -emit-llvm -g -c -o %t2.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --exit-on-error --debug-print-instructions=all:stderr %t2.bc 2>%t3.txt
// RUN: FileCheck -input-file=%t3.txt -check-prefix=CHECK-FILE-SRC %s
// RUN: FileCheck -input-file=%t3.txt -check-prefix=CHECK-FILE-DBG %s
// RUN: not test -f %t.klee-out/instructions.txt
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --exit-on-error --debug-print-instructions=all:file %t2.bc
// RUN: FileCheck -input-file=%t.klee-out/instructions.txt -check-prefix=CHECK-FILE-DBG %s
// RUN: FileCheck -input-file=%t.klee-out/instructions.txt -check-prefix=CHECK-FILE-SRC %s
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --exit-on-error --debug-print-instructions=src:file %t2.bc
// RUN: FileCheck -input-file=%t.klee-out/instructions.txt -check-prefix=CHECK-FILE-SRC %s
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --exit-on-error --debug-print-instructions=compact:file %t2.bc
// RUN: FileCheck -input-file=%t.klee-out/instructions.txt -check-prefix=CHECK-FILE-COMPACT %s
//
#include "klee/klee.h"
#include <assert.h>
#include <stdio.h>

char array[5] = { 1, 2, 3, -4, 5 };

int main() {
  unsigned k;

  klee_make_symbolic(&k, sizeof(k), "k");
  klee_assume(k < 5);

  if (array[k] == -4)
    printf("Yes\n");

  // CHECK-FILE-SRC: LoggingInstructions.c:27
  // CHECK-FILE-SRC: LoggingInstructions.c:28
  // CHECK-FILE-SRC: LoggingInstructions.c:30
  // CHECK-FILE-SRC: LoggingInstructions.c:31

  // CHECK-FILE-DBG: call void @klee_make_symbolic
  // CHECK-FILE-DBG: load

  // CHECK-FILE-COMPACT-NOT: LoggingInstructions.c:21
  // CHECK-FILE-COMPACT-NOT: LoggingInstructions.c:22
  // CHECK-FILE-COMPACT-NOT: LoggingInstructions.c:24
  // CHECK-FILE-COMPACT-NOT: LoggingInstructions.c:25

  return 0;
}