File: abc-test.sh

package info (click to toggle)
mcl 1%3A14-137-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 10,704 kB
  • ctags: 5,125
  • sloc: ansic: 53,217; sh: 4,448; perl: 3,967; makefile: 422
file content (142 lines) | stat: -rwxr-xr-x 3,973 bytes parent folder | download | duplicates (5)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/local/bin/bash

export MCLXIOVERBOSITY=2     # 2=forced-silent 8=forced-verbose
export TINGEA_LOG_TAG=x

set -e
# set -x

load='mx/mcxload'

NUM=5
have_arg=$#
REPEAT=1

if let $(($#)); then
   REPEAT=$1
fi

function out {
   s=$?
   if let $(($s)); then
      echo "error occurred! in cmode=$cmode rmode=$rmode"
   elif ! let $(($have_arg)); then
      rm -f xxx.* yyy.*
   fi
}

trap out SIGTERM # EXIT

for ((q=0;$q<$REPEAT;q=$(($q+1)))); do
echo "--- $q ---"
   for rmode in restrict extend; do
      for cmode in restrict extend; do
         for ((i=1;$i<=$NUM;i=$(($i+1)))); do

         N=$((20*$i))         # generate N lines
         k=$((2*$i))          # with k
         s=$((1*$i))          # with s sdev
         echo "generate $N $k $s"

         stem="xxx.$cmode.$rmode"

         # generate etc file.
         ./abc.pl $N $k $s > $stem.raw

         # load it, with various tab modes.
         $load -etc $stem.raw \
            -$rmode-tabr az.tab -write-tabr $stem.tabr \
            -$cmode-tabc az.tab -write-tabc $stem.tabc \
            -o $stem.mci > /dev/null

         # dump it with standard mcxdump.
         mcxdump -imx $stem.mci -tabr $stem.tabr -tabc $stem.tabc --no-values --lazy-tab | sort > $stem.dump.mci

         # dump the original input under the same extend/restrict conditions.
         ./abc-pairs.pl --rmode=$rmode --cmode=$cmode $stem.raw | sort -u > $stem.dump.raw

         # reload the loaded/dumped input with strict tabs; output is not further tested.
         $load --stream-split -abc $stem.dump.mci -strict-tabr $stem.tabr -strict-tabc $stem.tabc -o /dev/null > /dev/null

         # diff the abc-pairs and mcxload outputs.
         if diff -q $stem.dump.raw $stem.dump.mci; then
            echo "/ $rmode $cmode $i ok"
         else
            echo "/ $rmode $cmode $i error"
            false
         fi

      ##
      ## now, similarly for etc-ai mode
      ##

         rawfile=yyy.$rmode.raw
         cp  $stem.raw  $rawfile
         stem="yyy.$rmode"

         $load -etc-ai $rawfile \
            -$rmode-tabr az.tab -write-tabr $stem.tabr \
            -o $stem.mci > /dev/null
         mcxdump -imx $stem.mci -tabr $stem.tabr --no-values --lazy-tab | sort > $stem.dump.mci
         ./abc-pairs.pl --etcai --rmode=$rmode $rawfile | sort -u > $stem.dump.raw
         if diff -q $stem.dump.raw $stem.dump.mci; then
            echo "/ etcai $rmode $i ok"
         else
            echo "/ etcai $rmode $i error"
            false
         fi

         done

      # Originally we had something here to check symmetric load with etc.

      done
   done
done



# for rmode in restrict extend; do
#    for cmode in restrict extend; do
# 
#    for ((i=1;$i<=$NUM;i=$(($i+1)))); do
# 
#    N=$((100*$i))
# 
#    stem="yyy"
#    ./abc.pl $N 1 0 > $stem.raw
# 
#    $load -abc $stem.raw \
#       -$rmode-tabr az.tab -write-tabr $stem.rtab \
#       -$cmode-tabc az.tab -write-tabc $stem.ctab \
#       -o $stem.mci > /dev/null
#    mcxdump -imx $stem.mci -tabr $stem.rtab -tabc $stem.ctab --no-values | sort > $stem.dump.mci
#    $load -abc $stem.dump.mci -strict-tabc $stem.ctab -strict-tabr $stem.rtab -o /dev/null
#    ./abc-pairs.pl --rmode=$rmode --cmode=$cmode $stem.raw | sort -u > $stem.dump.raw
#    if diff -q $stem.dump.raw $stem.dump.mci; then
#       echo "/ $rmode $cmode $i ok"
#    else
#       echo "/ $rmode $cmode $i error"
#       false
#    fi
# 
#    done
# 
#    $load -abc $stem.raw \
#       -$rmode-tab az.tab -write-tab $stem.dtab \
#       -o $stem.dci > /dev/null
#    mcxdump -imx $stem.dci -tab $stem.dtab --no-values | sort > $stem.dump.dci
#    $load -abc $stem.dump.dci -strict-tab $stem.dtab -o /dev/null > /dev/null
#    ./abc-pairs.pl --rmode=$rmode --cmode=$rmode $stem.raw | sort -u > $stem.dump.daw
#    if diff -q $stem.dump.daw $stem.dump.dci; then
#       echo "= $rmode $i ok"
#    else
#       echo "= $rmode $i error"
#       false
#    fi
# 
#    done
# done