-
Notifications
You must be signed in to change notification settings - Fork 2
/
reduce
executable file
·41 lines (32 loc) · 1.05 KB
/
reduce
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
#!/usr/bin/env bash
set -ue
# script to prepare and start the testcase reduction process
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
rm -rf src
rm -f src.lst
# creduce works with flat files, and doesn't respect directories.
#
# to overcome this, we first discover which files to reduce,
# write them to a flat directory (src) and save the paths to a file (src.lst).
#
# during execution, we'll use that file to recover the original file hierarchy.
SOURCES=(main.jl)
if [[ -d "depot/dev" ]]; then
while IFS= read -r -d $'\0'; do
SOURCES+=("$REPLY")
done < <(find depot/dev -type f -name "*.jl" -print0)
fi
i=1
mkdir src
echo "Reducing the following sources:"
for path in "${SOURCES[@]}"; do
echo "- $path"
echo "$path" >> src.lst
ln -s "$DIR/$path" "src/$i.jl"
(( i++ ))
done
chmod +w src/*
nice -n 20 creduce --timeout 60 --tidy --n $(nproc) --not-c "$@" ./run src/*
# when using cvise, make sure to enter the src directory first
#cd src && nice -n 20 cvise --timeout 60 --tidy --n $(nproc) --not-c "$@" ../run *