From 1a087c7d23127b28610f76f201ddd5b750aa0080 Mon Sep 17 00:00:00 2001 From: Daniel Schemmel Date: Fri, 26 May 2023 01:06:45 +0000 Subject: 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. --- test/Feature/KleeStatsColumns.test | 6 +++++- test/Feature/KleeStatsCsv.test | 8 ++++++-- test/Feature/KleeStatsEmpty.test | 6 +++++- 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{{ *}}|{{$}} -- cgit 1.4.1