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