Changeset 3202
- Timestamp:
- 02/16/08 08:56:07 (10 months ago)
- Files:
-
- trunk/lib/unittest.sh (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/unittest.sh
r3176 r3202 13 13 } 14 14 15 usage() { 16 echo 'Usage: ./unittest.sh [otions ...] 17 Options: 18 --help: This message 19 --run-all: Reports result instead of breaking. Do not use this if you want to 20 run unittest runner through a debugger. 21 dmd: Builds unittests for dmd 22 gdc: Builds unittests for gdc 23 24 <none>: Builds unittests for all known compilers.' 25 exit 0 26 } 27 15 28 DC= 16 29 LIB= 30 RUNALL= 17 31 18 32 compile() { … … 32 46 module ${EXE}; 33 47 48 import tango.io.Stdout; 49 import tango.core.Runtime; 50 51 bool tangoUnitTester() 52 { 53 uint count = 0; 54 Stdout ("NOTE: This is still fairly rudimentary, and will only report the").newline; 55 Stdout (" first error per module.").newline; 56 foreach ( m; ModuleInfo ) // _moduleinfo_array ) 57 { 58 if ( m.unitTest) { 59 Stdout.format ("{}. Executing unittests in '{}' ", count, m.name); 60 try { 61 m.unitTest(); 62 } 63 catch (Exception e) { 64 Stdout(" - Unittest failed.").newline; 65 Stdout.format(" File '{}', line '{}'.", e.file, e.line).newline; 66 Stdout.format(" Message is : '{}'", e.msg).newline; 67 if (e.info) 68 Stdout.format(" TraceInfo: {}", e.info.toString).newline; 69 continue; 70 } 71 Stdout(" - Success.").newline; 72 count++; 73 } 74 } 75 return true; 76 } 77 78 static this() { 79 $RUNALL 80 } 81 34 82 void main() {} 35 83 EOF 36 84 37 rebuild - d-L-ldl -L-lz -debug=UnitTest -debug -full -clean -unittest -version=UnitTest $EXE.d tango/core/*.d tango/io/digest/*.d tango/io/model/*.d tango/io/protocol/*.d tango/io/selector/*.d tango/io/*.d tango/io/vfs/*.d tango/io/vfs/model/* tango/math/*.d tango/net/ftp/*.d tango/net/http/*.d tango/net/model/*.d tango/stdc/stringz.d tango/sys/*.d tango/text/convert/*.d tango/text/locale/Collation.d tango/text/locale/Convert.d tango/text/locale/Core.d tango/text/locale/Data.d tango/text/locale/Locale.d tango/text/locale/Parse.d tango/text/locale/Posix.d tango/text/stream/*.d tango/text/*.d tango/util/*.d tango/util/collection/model/*.d tango/util/collection/*.d tango/util/collection/iterator/*.d tango/util/collection/impl/*.d tango/util/log/model/*.d tango/util/log/*.d tango/time/chrono/*.d tango/time/*.d -dc=$DC-posix-tango85 rebuild -w -d -g -L-ldl -L-lz -debug=UnitTest -debug -full -clean -unittest -version=UnitTest $EXE.d tango/core/*.d tango/io/digest/*.d tango/io/model/*.d tango/io/protocol/*.d tango/io/selector/*.d tango/io/*.d tango/io/vfs/*.d tango/io/vfs/model/* tango/math/*.d tango/net/ftp/*.d tango/net/http/*.d tango/net/model/*.d tango/stdc/stringz.d tango/sys/*.d tango/text/convert/*.d tango/text/locale/Collation.d tango/text/locale/Convert.d tango/text/locale/Core.d tango/text/locale/Data.d tango/text/locale/Locale.d tango/text/locale/Parse.d tango/text/locale/Posix.d tango/text/stream/*.d tango/text/*.d tango/util/*.d tango/util/collection/model/*.d tango/util/collection/*.d tango/util/collection/iterator/*.d tango/util/collection/impl/*.d tango/util/log/model/*.d tango/util/log/*.d tango/time/chrono/*.d tango/time/*.d -dc=$DC-posix-tango 38 86 39 87 mv $EXE lib/$EXE … … 45 93 } 46 94 47 compile dmd runUnitTest_dmd 48 compile gdc runUnitTest_gdc 95 while [ "$#" != "0" ] 96 do 97 case "$1" in 98 --help) 99 usage 100 ;; 101 --run-all) 102 RUNALL="Runtime.moduleUnitTester( &tangoUnitTester );" 103 ;; 104 dmd) 105 DMD=1 106 ;; 107 gdc) 108 GDC=1 109 ;; 110 *) 111 usage 112 ;; 113 esac 114 shift 115 done 116 117 if [ ! "$DMD" -a ! "$GDC" ] 118 then 119 DMD=1 120 GDC=1 121 fi 122 123 if [ "$DMD" = "1" ] 124 then 125 compile dmd runUnitTest_dmd 126 fi 127 if [ "$GDC" = "1" ] 128 then 129 compile gdc runUnitTest_gdc 130 fi 131












