#! /bin/sh # # run scripts and compare results with ../data/ files # to reproduce rand() values # export SRAND=987654321 # number of differences # echo "0" > .count # script alt_option output_files... # echo 'BV.sh X BV-16-0.9.out BV-16-0.9.gif BV.sh def2 BV-16-0.95.out BV-16-0.95.gif BV.sh alt1 BVe-0.0.out BVe-0.0.gif BVe-0.2.out BVe-0.2.gif BVe-0.4.out BVe-0.4.gif BVe-0.6.out BVe-0.6.gif BV.sh alt2 BV-0.0.out BV-0.0.gif BV-0.5.out BV-0.5.gif BV-0.75.out BV-0.75.gif BV-1.0.out BV-1.0.gif DJ-e.sh X DJe-1.2.out DJe-1.4.out DJe-1.6.out DJe3.gif DJ-e.sh alt DJe.out DJe.gif DJ.sh X DJ.out DJ.gif Grover-coin.sh X Grover-coin-8.out Grover-coin-8.gif Grover-coin-256.out Grover-coin-256.gif Grover-p.sh X Grover-0.25.out Grover-0.25.gif Grover.sh X Grover-ra+0.05.out Grover-ra+0.05.gif Grover-ra+0.1.out Grover-ra+0.1.gif Shor.sh X Shor.33.5.out Shor.33.5.gif Shor.sh 23 Shor.33.23.out Shor.33.23.gif corvids.sh X corvids-c1.out corvids-c2.out corvids-c4.out' | while read script alt files do #-- for f in $files #-- do #-- echo "$f" #-- ls ../data/$f > /dev/null #-- done #-- continue # if [ "$alt" = "X" ]; then alt="" fi echo $script $alt ./$script $alt > /dev/null 2>&1 for f in $files do echo " $f" x=$(diff ../data/$f $f | head -20) if [ -n "$x" ]; then count=$(cat .count) count=$((count+1)) echo "$count" > .count echo "$x" fi done done # using .count file because the while loop is in a subshell (due to pipe input) # so it can't affect count variable in parent # count=$(cat .count) echo "$count differences" rm -f .count