blob: 0a5d0abb0660f7c8cd32c94aac47e89258a9bccb [file] [log] [blame]
RUN: %cpp_compiler %S/FullCoverageSetTest.cpp -o %t-FullCoverageSetTest
RUN: rm -rf %t/T1 %t/T2
RUN: mkdir -p %t/T1 %t/T2
RUN: echo F..... > %t/T1/1
RUN: echo .U.... > %t/T1/2
RUN: echo ..Z... > %t/T1/3
# T1 has 3 elements, T2 is empty.
RUN: %run %t-FullCoverageSetTest -set_cover_merge=1 %t/T1 %t/T2 2>&1 | FileCheck %s --check-prefix=CHECK1
CHECK1: MERGE-OUTER: 3 files, 3 in the initial corpus
CHECK1: MERGE-OUTER: 0 new files with 0 new features added
RUN: echo ...Z.. > %t/T2/1
RUN: echo ....E. > %t/T2/2
RUN: echo .....R > %t/T2/3
RUN: echo F..... > %t/T2/a
RUN: echo .U.... > %t/T2/b
RUN: echo ..Z... > %t/T2/c
# T1 has 3 elements, T2 has 6 elements, only 3 are new.
RUN: %run %t-FullCoverageSetTest -set_cover_merge=1 %t/T1 %t/T2 2>&1 | FileCheck %s --check-prefix=CHECK2
CHECK2: MERGE-OUTER: 9 files, 3 in the initial corpus
CHECK2: MERGE-OUTER: 3 new files with 3 new features added
# Now, T1 has 6 units and T2 has no new interesting units.
RUN: %run %t-FullCoverageSetTest -set_cover_merge=1 %t/T1 %t/T2 2>&1 | FileCheck %s --check-prefix=CHECK3
CHECK3: MERGE-OUTER: 12 files, 6 in the initial corpus
CHECK3: MERGE-OUTER: 0 new files with 0 new features added
RUN: rm -rf %t/T1/* %t/T2/*
RUN: mkdir -p %t/T3
RUN: echo ...... > %t/T1/1
RUN: echo F..... > %t/T2/a
RUN: echo .U.... > %t/T2/b
RUN: echo ..Z... > %t/T2/c
RUN: echo ...Z.. > %t/T3/1
RUN: echo ....E. > %t/T3/2
RUN: echo .....R > %t/T3/3
RUN: echo .UZZER. > %t/T3/a
RUN: echo .UZZER.. > %t/T3/b
RUN: echo ...... > %t/T3/c
# T1 is empty, T2 and T3 have overlapping features. The optimal solution
# consists of 2 files: T2/a, T3/a. These files cover 6 new features.
# Although T3/a is larger in size (1 more byte) we prefer it because
# it covers more features than any other file.
RUN: %run %t-FullCoverageSetTest -set_cover_merge=1 %t/T1 %t/T2 %t/T3 2>&1 | FileCheck %s --check-prefix=CHECK_OVERLAP
CHECK_OVERLAP: MERGE-OUTER: 10 files, 1 in the initial corpus
CHECK_OVERLAP: MERGE-OUTER: 2 new files with 6 new features added
# Make sure that we are prefering smaller files (T3/a over T3/b).
RUN: diff %t/T1/1b2301992a0266982b135fee5164937d7f7abca3 %t/T3/a
RUN: rm -rf %t/T1/* %t/T2/* %t/T3/*
RUN: echo ...... > %t/T1/1
RUN: echo F..... > %t/T2/a
RUN: echo .U.... > %t/T2/b
RUN: echo ..Z... > %t/T2/c
RUN: echo ...Z.. > %t/T3/1
RUN: echo ....E. > %t/T3/2
RUN: echo .....R > %t/T3/3
RUN: echo .UZZER. > %t/T3/a
RUN: echo .UZZER.. > %t/T3/b
RUN: echo ...... > %t/T3/c
# Test the previous scenario with the '-merge=1' flag.
# Expect more files to be added to the first corpus, since '-merge=1'
# is going to prefer smaller files and ignore the fact that
# T3/a covers almost all of the available features.
RUN: %run %t-FullCoverageSetTest -merge=1 %t/T1 %t/T2 %t/T3 2>&1 | FileCheck %s --check-prefix=CHECK_OVERLAP2
CHECK_OVERLAP2: MERGE-OUTER: 10 files, 1 in the initial corpus
CHECK_OVERLAP2: MERGE-OUTER: 6 new files with 6 new features added