about summary refs log tree commit diff homepage
path: root/test/Feature
diff options
context:
space:
mode:
authorDaniel Schemmel <daniel@schemmel.net>2023-05-26 01:06:45 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-05-26 21:06:50 +0100
commit1a087c7d23127b28610f76f201ddd5b750aa0080 (patch)
tree6363f492c5c2a4501175425dcbfdc0f66c181285 /test/Feature
parentd3db14ce3b0a3b4902d74a517c08fd19e8469e9e (diff)
downloadklee-1a087c7d23127b28610f76f201ddd5b750aa0080.tar.gz
Copy stats to test directory when running tests
The sqlite3 databases used for the stats are journalled and potentially
must be written to. Therefore, the sqlite3 driver used by `klee-stats`
requires write permissions on the database files.

By copying the stats files to the test directory, we can now compile and
test an out-of-tree build without requiring any write permissions on the
source folder at all.
Diffstat (limited to 'test/Feature')
-rw-r--r--test/Feature/KleeStatsColumns.test6
-rw-r--r--test/Feature/KleeStatsCsv.test8
-rw-r--r--test/Feature/KleeStatsEmpty.test6
3 files changed, 16 insertions, 4 deletions
diff --git a/test/Feature/KleeStatsColumns.test b/test/Feature/KleeStatsColumns.test
index 6fcbdf4b..1ebe1e37 100644
--- a/test/Feature/KleeStatsColumns.test
+++ b/test/Feature/KleeStatsColumns.test
@@ -1,4 +1,8 @@
-RUN: %klee-stats --print-all %S/klee-stats/missing_column %S/klee-stats/run %S/klee-stats/additional_column | FileCheck %s
+// sqlite databases must be opened with write permissions, so we copy the test cases to the output dir
+RUN: rm -rf %t.klee-stats
+RUN: mkdir %t.klee-stats
+RUN: cp -r %S/klee-stats/missing_column %S/klee-stats/run %S/klee-stats/additional_column %t.klee-stats/
+RUN %klee-stats --print-all %t.klee-stats/missing_column %t.klee-stats/run %t.klee-stats/additional_column | FileCheck %s
 
 // Path, Instrs, ..., extra_column
 CHECK: {{^}}| missing_column  |        |{{.*}}|             |{{$}}
diff --git a/test/Feature/KleeStatsCsv.test b/test/Feature/KleeStatsCsv.test
index 26bfac09..e923f68d 100644
--- a/test/Feature/KleeStatsCsv.test
+++ b/test/Feature/KleeStatsCsv.test
@@ -1,5 +1,9 @@
-RUN: %klee-stats --table-format=csv %S/klee-stats/run | FileCheck --check-prefix=CHECK-CSV %s
-RUN: %klee-stats --table-format=readable-csv %S/klee-stats/run | FileCheck --check-prefix=CHECK-READABLECSV %s
+// sqlite databases must be opened with write permissions, so we copy the test cases to the output dir
+RUN: rm -rf %t.klee-stats
+RUN: mkdir %t.klee-stats
+RUN: cp -r %S/klee-stats/run %t.klee-stats/
+RUN: %klee-stats --table-format=csv %t.klee-stats/run | FileCheck --check-prefix=CHECK-CSV %s
+RUN: %klee-stats --table-format=readable-csv %t.klee-stats/run | FileCheck --check-prefix=CHECK-READABLECSV %s
 
 CHECK-CSV: Path,Instrs,Time(s),ICov(%),BCov(%),ICount,TSolver(%)
 CHECK-CSV: klee-stats/run,3,0.00,100.00,100.00,3,0.00
diff --git a/test/Feature/KleeStatsEmpty.test b/test/Feature/KleeStatsEmpty.test
index aae1fee1..64524f38 100644
--- a/test/Feature/KleeStatsEmpty.test
+++ b/test/Feature/KleeStatsEmpty.test
@@ -1,4 +1,8 @@
-RUN: %klee-stats %S/klee-stats/empty | FileCheck %s
+// sqlite databases must be opened with write permissions, so we copy the test cases to the output dir
+RUN: rm -rf %t.klee-stats
+RUN: mkdir %t.klee-stats
+RUN: cp -r %S/klee-stats/empty %t.klee-stats/
+RUN: %klee-stats %t.klee-stats/empty | FileCheck %s
 
 CHECK: {{^}}|{{ *}}Path{{ *}}|{{$}}
 CHECK: {{^}}|{{.*}}empty{{ *}}|{{$}}