Subversion Repositories wimsdev

Rev

Rev 8948 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 reyssat 1
#! /bin/sh
2
#
3
#	This script compiles all OEF exercises on the server.
4
#	You don't need to run this under normal circumstances.
5
#
6
#	Type './oefcompile clean' if you want to clean up
7
#	earlier-compiled exercises before recompiling.
8
#
9
 
10
# base directory.
11
 
12
 
8948 bpr 13
 
3 reyssat 14
test=`dirname $0`
15
if [ -z "$test" ]; then WIMS_HOME=..; else WIMS_HOME=$test/..; fi
16
cd $WIMS_HOME
17
WIMS_HOME=`pwd`
18
PATH=$PATH:$WIMS_HOME/other/bin
19
module_dir=$WIMS_HOME/public_html/modules
8948 bpr 20
WIMS_OEFTEST=$WIMS_HOME/wimstest/ALLOEF
21
if [ "$1" = "test" ]; then
22
  mkdir -p $WIMS_OEFTEST
23
else
24
  echo "This script must be used for test with argument test ; now obsolete. Blocked."
25
  exit
26
fi
3 reyssat 27
 
28
cd $module_dir
9053 bpr 29
if [ "$2" ]; then candidates="$2" ; else
3 reyssat 30
candidates=`find [A-Zlc]* -name src -type d | sed 's!/src$!!'`
9053 bpr 31
fi
3 reyssat 32
srctotal=0
33
deftotal=0
34
for d in $candidates
35
do
36
 if [ ! -f $d/INDEX ] || [ ! -d $d/def ] || [ ! -d $d/src ]; then continue; fi
37
 srccnt=`ls $d/src/*.oef 2>/dev/null | grep -c '\.oef$'`
38
 if [ $srccnt -eq 0 ]; then continue; fi
39
 cd $d
40
 if [ "$1" = "clean" ]; then
41
  rm -f def/*.def 2>/dev/null
42
 fi
8948 bpr 43
 if [ "$1" = "test" ]; then
44
  rm -rf def.orig
45
  cp -r def def.orig
9053 bpr 46
  rm -f def/*.def 2>/dev/null
8948 bpr 47
 fi
3 reyssat 48
 src2def >/dev/null 2>&1
49
 defcnt=`ls def/*.def 2>/dev/null | grep -c '\.def$'`
50
 if [ $defcnt -gt $srccnt ]; then defcnt=$srccnt; fi
51
 failcnt=`expr $srccnt - $defcnt`
52
 srctotal=`expr $srctotal + $srccnt`
53
 deftotal=`expr $deftotal + $defcnt`
54
 if [ $failcnt -gt 0 ]; then
55
  echo $d: $srccnt sources, $defcnt compiled, $failcnt failure.
56
 else
57
  echo $d: $srccnt sources, OK.
58
 fi
8948 bpr 59
 if [ "$1" = "test" ]; then
60
     d1=`echo $d | sed "s,/,~,g"`
61
     echo "$d1 .........\c"
62
     rm -f "$WIMS_OEFTEST/$d1.diff"
63
     for ii in def.orig/* ; do
64
        jj=`basename $ii`; echo "Testing $jj... \c"
65
         if ! cmp def/$jj def.orig/$jj ; then
66
           echo "CHANGE in $d/$jj ...\c"
67
           diff -c def/$jj def.orig/$jj >> $WIMS_OEFTEST/$d1.diff
68
         fi
69
      done
70
      rm -rf def; mv def.orig def
71
 fi
3 reyssat 72
 cd $module_dir
73
done
74
 
75
failtotal=`expr $srctotal - $deftotal`
76
cat <<@
77
 
78
Total: $srctotal sources, $deftotal compiled.
79
Total failure: $failtotal
80
 
81
@
82
 
83