mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	Wire up the encode/decode tests. Hey, look, failures!
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -50,7 +50,7 @@ CFLAGS += -Ilib -Idep/fmt -Iarch | ||||
| export OBJDIR = .obj | ||||
|  | ||||
| all: .obj/build.ninja | ||||
| 	@ninja -f .obj/build.ninja | ||||
| 	@ninja -f .obj/build.ninja -v | ||||
| 	@if command -v cscope > /dev/null; then cscope -bRq; fi | ||||
|  | ||||
| clean: | ||||
|   | ||||
| @@ -115,6 +115,8 @@ public: | ||||
| 		IbmEncoderProto::TrackdataProto trackdata; | ||||
| 		getTrackFormat(trackdata, physicalTrack, physicalSide); | ||||
|  | ||||
| 		if (trackdata.swap_sides()) | ||||
| 			physicalSide = 1 - physicalSide; | ||||
| 		for (char sectorChar : trackdata.sector_skew()) | ||||
|         { | ||||
| 			int sectorId = charToInt(sectorChar); | ||||
|   | ||||
							
								
								
									
										53
									
								
								mkninja.sh
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								mkninja.sh
									
									
									
									
									
								
							| @@ -35,6 +35,10 @@ rule test | ||||
|     command = \$in && touch \$out | ||||
|     description = TEST \$in | ||||
|  | ||||
| rule encodedecode | ||||
|     command = sh scripts/encodedecodetest.sh \$format > \$out | ||||
|     description = ENCODEDECODE \$format | ||||
|  | ||||
| rule strip | ||||
|     command = cp -f \$in \$out && $STRIP \$out | ||||
|     description = STRIP \$in | ||||
| @@ -255,6 +259,14 @@ runtest() { | ||||
|     echo build $OBJDIR/$prog.stamp : test $OBJDIR/$prog-debug$EXTENSION | ||||
| } | ||||
|  | ||||
| encodedecodetest() { | ||||
|     local format | ||||
|     format=$1 | ||||
|  | ||||
|     echo "build $OBJDIR/$format.encodedecode.stamp : encodedecode | fluxengine scripts/encodedecodetest.sh" | ||||
|     echo "    format=$format" | ||||
| } | ||||
|  | ||||
| buildlibrary libagg.a \ | ||||
|     -Idep/agg/include \ | ||||
|     dep/stb/stb_image_write.c \ | ||||
| @@ -374,13 +386,8 @@ buildlibrary libbackend.a \ | ||||
|     lib/utils.cc \ | ||||
|     lib/writer.cc \ | ||||
|  | ||||
| FORMATS="\ | ||||
|     acornadfs \ | ||||
|     acorndfs \ | ||||
|     aeslanier \ | ||||
| RWFORMATS="\ | ||||
|     amiga \ | ||||
|     ampro \ | ||||
|     apple2 \ | ||||
|     atarist360 \ | ||||
|     atarist370 \ | ||||
|     atarist400 \ | ||||
| @@ -393,41 +400,49 @@ FORMATS="\ | ||||
|     brother240 \ | ||||
|     commodore1541 \ | ||||
|     commodore1581 \ | ||||
|     eco1 \ | ||||
|     f85 \ | ||||
|     fb100 \ | ||||
|     hplif770 \ | ||||
|     ibm \ | ||||
|     ibm1200_525 \ | ||||
|     ibm1440 \ | ||||
|     ibm180_525 \ | ||||
|     ibm360_525 \ | ||||
|     ibm720 \ | ||||
|     ibm720_525 \ | ||||
|     mac400 \ | ||||
|     mac800 \ | ||||
|     micropolis \ | ||||
|     mx \ | ||||
|     northstar87 \ | ||||
|     northstar175 \ | ||||
|     northstar350 \ | ||||
|     tids990 \ | ||||
|     " | ||||
|  | ||||
| ROFORMATS="\ | ||||
|     acornadfs \ | ||||
|     acorndfs \ | ||||
|     aeslanier \ | ||||
|     ampro \ | ||||
|     apple2 \ | ||||
|     eco1 \ | ||||
|     f85 \ | ||||
|     fb100 \ | ||||
|     hplif770 \ | ||||
|     ibm \ | ||||
|     mac400 \ | ||||
|     micropolis \ | ||||
|     mx \ | ||||
|     victor9k \ | ||||
|     zilogmcz \ | ||||
|     " | ||||
|  | ||||
| for pb in $FORMATS; do | ||||
| for pb in $RWFORMATS $ROFORMATS; do | ||||
|     buildencodedproto $OBJDIR/proto/libconfig.def ConfigProto \ | ||||
|         formats_${pb}_pb src/formats/$pb.textpb $OBJDIR/proto/src/formats/$pb.cc | ||||
| done | ||||
|  | ||||
| buildmktable formats $OBJDIR/formats.cc $FORMATS | ||||
| buildmktable formats $OBJDIR/formats.cc $RWFORMATS $ROFORMATS | ||||
|  | ||||
| buildlibrary libfrontend.a \ | ||||
|     -I$OBJDIR/proto \ | ||||
|     -d $OBJDIR/proto/libconfig.def \ | ||||
|     -d $OBJDIR/proto/libdata.def \ | ||||
|     $(for a in $FORMATS; do echo $OBJDIR/proto/src/formats/$a.cc; done) \ | ||||
|     $(for a in $RWFORMATS $ROFORMATS; do echo $OBJDIR/proto/src/formats/$a.cc; done) \ | ||||
|     $OBJDIR/formats.cc \ | ||||
|     src/fe-analysedriveresponse.cc \ | ||||
|     src/fe-analyselayout.cc \ | ||||
| @@ -492,5 +507,9 @@ runtest proto-test          -I$OBJDIR/proto \ | ||||
|                             tests/proto.cc \ | ||||
|                             $OBJDIR/proto/tests/testproto.cc | ||||
|  | ||||
| for f in $RWFORMATS; do | ||||
|     encodedecodetest $f | ||||
| done | ||||
|  | ||||
| # vim: sw=4 ts=4 et | ||||
|  | ||||
|   | ||||
| @@ -8,18 +8,18 @@ format=$1 | ||||
|  | ||||
| trap "rm -f $srcfile $fluxfile $destfile" EXIT | ||||
|  | ||||
| dd if=/dev/urandom of=$srcfile bs=1M count=2 | ||||
| dd if=/dev/urandom of=$srcfile bs=1M count=2 2>1 | ||||
|  | ||||
| ./fluxengine write $format -i $srcfile -d $fluxfile | ||||
| ./fluxengine read $format -s $fluxfile -o $destfile | ||||
| if [ ! -s $destfile ]; then | ||||
| 	echo "Zero length output file!" | ||||
| 	echo "Zero length output file!" >&2 | ||||
| 	exit 1 | ||||
| fi | ||||
|  | ||||
| truncate $srcfile -r $destfile | ||||
| if ! cmp $srcfile $destfile; then | ||||
| 	echo "Comparison failed!" | ||||
| 	echo "Comparison failed!" >&2 | ||||
| 	exit 1 | ||||
| fi | ||||
| exit 0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user