Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.

Commit 2b197c8

Browse files
committed
extend process.sh to support patch stages
The idea is that we want to support incremental tests where we do some base build step and then apply a series of patches. We want to track the compilation time after each of these patches separately. The model is that from one directory $DIR we will create N files, one for each patch. They will be named $DIR@$PATCH -- they are basically independent tests from the POV of the front-end. This is achieved by extending the makefile protocol mildly. There is now a new target `make patches` that emits a list of patch names. These should include the separator (e.g., `@foo`, `@bar`). If the list of patches returned is empty, the code works as before. We execute '(make all; make touch)+ make clean'. The results from 'make all' are stored in `$dir--$DATE--$i`. If the last of patches is *non-empty* (say '@A @b'), then we execute '(make all@A; make all@B; make touch)+ make clean'. The results from 'make all' are stored in `$dir@A--$DATE--$i` and `$dir@B--$DATE--$i`. The naming convention for variants is as follows: @NNN-text where NN is 000, 010, 020, 030, etc, and text is some useful description. The @ is a distinctive separator we can special-case in the front-end later.
1 parent ab9ff5e commit 2b197c8

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

process.sh

+43-14
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,66 @@
11
#!/bin/bash
22

3-
TIMES_DIR=/home/ncameron/times
4-
SCRIPTS_DIR=/home/ncameron/times-scripts
3+
if [ -z "$TIMES_DIR" ]; then
4+
TIMES_DIR=/home/ncameron/times
5+
fi
6+
if [ -z "$SCRIPTS_DIR" ]; then
7+
SCRIPTS_DIR=/home/ncameron/times-scripts
8+
fi
9+
10+
echo TIMES_DIR=$TIMES_DIR
11+
echo SCRIPTS_DIR=$SCRIPTS_DIR
512

613
START=$(pwd)
714
export CARGO_RUSTC_OPTS="-Ztime-passes -Zinput-stats"
815
export PATH=$RUSTC_DIR/bin:$PATH
916

10-
for dir in *; do
17+
# Check if user provided list of directories;
18+
# else process them all.
19+
if [ "$1" != "" ]; then
20+
DIRS="$@"
21+
else
22+
DIRS="*"
23+
fi
24+
25+
for dir in $DIRS; do
1126
if [[ -d $dir ]]; then
1227
echo "Processing $dir"
1328

29+
cd $START/$dir
30+
PATCHES=($(make patches))
31+
if [ ! "${PATCHES[*]}" ]; then
32+
PATCHES=('')
33+
fi
34+
35+
echo Patches: ${PATCHES[*]}
36+
1437
for i in 0 1 2 3 4 5
1538
do
16-
cd $RUST_DIR
17-
git show HEAD -s >$TIMES_DIR/raw/$dir--$DATE--$i.log
18-
cd $START/$dir
19-
echo "rustc: ./$dir" >>$TIMES_DIR/raw/$dir--$DATE--$i.log
20-
make >>$TIMES_DIR/raw/$dir--$DATE--$i.log
21-
echo "done" >>$TIMES_DIR/raw/$dir--$DATE--$i.log
22-
39+
for PATCH in "${PATCHES[@]}"; do
40+
cd $RUST_DIR
41+
git show HEAD -s >$TIMES_DIR/raw/$dir$PATCH--$DATE--$i.log
42+
cd $START/$dir
43+
echo "rustc: ./$dir" >>$TIMES_DIR/raw/$dir$PATCH--$DATE--$i.log
44+
make all$PATCH >>$TIMES_DIR/raw/$dir$PATCH--$DATE--$i.log
45+
echo "done" >>$TIMES_DIR/raw/$dir$PATCH--$DATE--$i.log
46+
done
2347
make touch >/dev/null
2448
done
2549

2650
make clean >/dev/null
2751

2852
cd $TIMES_DIR
29-
python $SCRIPTS_DIR/process.py $dir $DATE 6
53+
for PATCH in "${PATCHES[@]}"; do
54+
python $SCRIPTS_DIR/process.py "$dir$PATCH" "$DATE" 6
55+
done
56+
3057
for i in 0 1 2 3 4 5
3158
do
32-
git add raw/$dir--$DATE--$i.log
33-
git add raw/orbit-$dir--$DATE--$i.log
34-
git add processed/$dir--$DATE--$i.json
59+
for PATCH in "${PATCHES[@]}"; do
60+
git add "raw/$dir$PATCH--$DATE--$i.log"
61+
git add "raw/orbit-$dir$PATCH--$DATE--$i.log"
62+
git add "processed/$dir$PATCH--$DATE--$i.json"
63+
done
3564
done
3665

3766
cd $START

0 commit comments

Comments
 (0)