]> mj.ucw.cz Git - eval.git/blob - mop/eval/mo-ev-inc.sh
mo-score: Since STDOUT may be a pipe, we need to close it
[eval.git] / mop / eval / mo-ev-inc.sh
1 #!/bin/bash
2 # An incremental evaluator: detect which solutions were changed since
3 # last run and run `ev' on them.
4
5 [ -n "$1" ] || { echo "Usage: mo-ev-inc [--force] <tasks>" ; exit 1 ; }
6
7 force=0
8 if [ "$1" == --force ] ; then
9         force=1
10         shift
11 fi
12 for user in `bin/mo-get-users` ; do
13         for task in "$@" ; do
14                 echo -n "$user/$task: "
15                 if [ -d solutions/$user/$task ] ; then
16                         N=`cd solutions/$user/$task && cat * | md5sum | head -c16` 
17                 else
18                         N=none
19                 fi
20                 if [ -f testing/$user/$task/sum ] ; then
21                         O=`cat testing/$user/$task/sum`
22                 else
23                         O=none
24                 fi
25                 if [ $force == 1 -a $N != none ] ; then
26                         O=forced
27                 fi
28                 echo -n "($O $N) "
29                 if [ $O == $N ] ; then
30                         echo OK
31                 elif [ $N == none ] ; then
32                         rm -rf testing/$user/$task
33                         echo DELETED
34                 else
35                         echo CHANGED
36                         bin/ev $user $task
37                         echo $N >testing/$user/$task/sum
38                 fi
39         done
40 done