test/org/openjdk/jigsaw/tester.sh

Print this page




  86 # `\{' is used that causes the warning on other platforms.
  87 #
  88 $AWK -v sep="$FS" -v dash_p="$DASH_P" '
  89   function toPath(dir, name) {
  90     return sprintf("%s%s%s", dir, sep, name)
  91   }
  92   function mkdir(dir) {
  93     system("mkdir " dash_p " " dir);
  94   }
  95 
  96   /^:/ {
  97     test = $2; status = $3; how = $4;
  98     tdir = sprintf("%03d%s", tcount++, $2);
  99     mkdir(tdir);
 100     if (NF == 3) e = $3; else e = $3 " " $4;
 101     efile = toPath(tdir, "expected");
 102     print e >efile;
 103     close(efile);
 104     msdir = toPath(tdir, "src");
 105     mkdir(msdir);

 106   }
 107 
 108   /^module / {
 109     module = $2;
 110     mname = module;
 111     mdir = toPath(msdir, mname);
 112     mkdir(mdir);
 113     if (mfile != "") close(mfile);
 114     mfile = toPath(mdir, "module-info.java");
 115     print $0 >mfile;
 116     next;
 117   }
 118 
 119   /^package / {
 120     pkgpre = $0;
 121     pname = $2;
 122     gsub("\\.", sep, pname);
 123     gsub("(;| )", "", pname);
 124     pdir = toPath(mdir, pname);
 125     mkdir(pdir);


 130   /^import / {
 131     pkgpre = pkgpre "\n" $0;
 132     next;
 133   }
 134 
 135   /.* (class|interface) .* *\{ *\}? *$/ {
 136     class = $0;
 137     sub(" +\{ *\}? *", "", class);
 138     sub(".*class +", "", class);
 139     if (cfile != "") close(cfile);
 140     cfile = toPath(pdir, class ".java");
 141     print pkgpre >>cfile;
 142     print $0 >>cfile;
 143     pkgpre = "";
 144     next;
 145   }
 146 
 147   /^./ {
 148     if (module) {
 149       print $0 >>mfile;
 150       if (match($0, /^ +class +([a-zA-Z.]+) *;/)) print module >toPath(tdir, "main");



 151     }


 152     if (class) print $0 >>cfile;
 153     next;
 154   }
 155 
 156   /^#?$/ { module = 0; class = 0; }
 157 
 158   /.+/ { if (module || class) print $0; }
 159 
 160 ' $tsrc
 161 
 162 tests=`echo * | wc -w`
 163 if [ $tests = 1 ]; then
 164   d=`echo *`
 165   mv $d/* .
 166   rmdir $d
 167 fi
 168 
 169 failures=0
 170 fail() {
 171   echo "FAIL: $*"


 227       step compile pass && step install pass && step invoke fail;;
 228     'pass setup')
 229       ;;
 230     'pass compile')
 231       step compile pass;;
 232     pass)
 233       step compile pass && step install pass && step invoke pass;;
 234     *)
 235       fail "Unhandled expected result: $e";;
 236   esac
 237 }
 238 
 239 if [ $tests = 1 ]; then
 240   run singleton || /bin/true
 241 else
 242   pdir=`echo $BIN | cut -c1-3`
 243   if [ -z "$TESTSRC" -a "$pdir" = "../" ]; then
 244     BIN=../$BIN;
 245   fi
 246   for t in *; do

 247     cd $t
 248     run `echo $t | cut -c4-` || /bin/true
 249     cd ..

 250   done
 251 fi
 252 
 253 if [ $tests -gt 1 ]; then
 254   echo
 255   echo "== $tests tests, $failures failure(s)"
 256 fi
 257 
 258 exit $failures


  86 # `\{' is used that causes the warning on other platforms.
  87 #
  88 $AWK -v sep="$FS" -v dash_p="$DASH_P" '
  89   function toPath(dir, name) {
  90     return sprintf("%s%s%s", dir, sep, name)
  91   }
  92   function mkdir(dir) {
  93     system("mkdir " dash_p " " dir);
  94   }
  95 
  96   /^:/ {
  97     test = $2; status = $3; how = $4;
  98     tdir = sprintf("%03d%s", tcount++, $2);
  99     mkdir(tdir);
 100     if (NF == 3) e = $3; else e = $3 " " $4;
 101     efile = toPath(tdir, "expected");
 102     print e >efile;
 103     close(efile);
 104     msdir = toPath(tdir, "src");
 105     mkdir(msdir);
 106     moduleclassFound = 0;
 107   }
 108 
 109   /^module / {
 110     module = $2;
 111     mname = module;
 112     mdir = toPath(msdir, mname);
 113     mkdir(mdir);
 114     if (mfile != "") close(mfile);
 115     mfile = toPath(mdir, "module-info.java");
 116     print $0 >mfile;
 117     next;
 118   }
 119 
 120   /^package / {
 121     pkgpre = $0;
 122     pname = $2;
 123     gsub("\\.", sep, pname);
 124     gsub("(;| )", "", pname);
 125     pdir = toPath(mdir, pname);
 126     mkdir(pdir);


 131   /^import / {
 132     pkgpre = pkgpre "\n" $0;
 133     next;
 134   }
 135 
 136   /.* (class|interface) .* *\{ *\}? *$/ {
 137     class = $0;
 138     sub(" +\{ *\}? *", "", class);
 139     sub(".*class +", "", class);
 140     if (cfile != "") close(cfile);
 141     cfile = toPath(pdir, class ".java");
 142     print pkgpre >>cfile;
 143     print $0 >>cfile;
 144     pkgpre = "";
 145     next;
 146   }
 147 
 148   /^./ {
 149     if (module) {
 150       print $0 >>mfile;
 151       if (match($0, /^ +class +([a-zA-Z.]+) *;/)) {
 152           if (moduleclassFound == 0) {
 153               print module >toPath(tdir, "main");
 154               moduleclassFound = 1;
 155          }
 156       }
 157     }
 158     if (class) print $0 >>cfile;
 159     next;
 160   }
 161 
 162   /^#?$/ { module = 0; class = 0; }
 163 
 164   /.+/ { if (module || class) print $0; }
 165 
 166 ' $tsrc
 167 
 168 tests=`echo * | wc -w`
 169 if [ $tests = 1 ]; then
 170   d=`echo *`
 171   mv $d/* .
 172   rmdir $d
 173 fi
 174 
 175 failures=0
 176 fail() {
 177   echo "FAIL: $*"


 233       step compile pass && step install pass && step invoke fail;;
 234     'pass setup')
 235       ;;
 236     'pass compile')
 237       step compile pass;;
 238     pass)
 239       step compile pass && step install pass && step invoke pass;;
 240     *)
 241       fail "Unhandled expected result: $e";;
 242   esac
 243 }
 244 
 245 if [ $tests = 1 ]; then
 246   run singleton || /bin/true
 247 else
 248   pdir=`echo $BIN | cut -c1-3`
 249   if [ -z "$TESTSRC" -a "$pdir" = "../" ]; then
 250     BIN=../$BIN;
 251   fi
 252   for t in *; do
 253     if [ -d $t ] ; then
 254       cd $t
 255       run `echo $t | cut -c4-` || /bin/true
 256       cd ..
 257     fi
 258   done
 259 fi
 260 
 261 if [ $tests -gt 1 ]; then
 262   echo
 263   echo "== $tests tests, $failures failure(s)"
 264 fi
 265 
 266 exit $failures