diff options
Diffstat (limited to 'seek-bzip2/Makefile')
-rw-r--r-- | seek-bzip2/Makefile | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/seek-bzip2/Makefile b/seek-bzip2/Makefile new file mode 100644 index 0000000..a9c9881 --- /dev/null +++ b/seek-bzip2/Makefile @@ -0,0 +1,40 @@ +CC = gcc -m64 +CFLAGS = -O3 # -DTESTING + +PROGS=bzip-table seek-bunzip + +all: $(PROGS) + +bzip-table : bzip-table.o micro-bunzip.o +seek-bunzip : seek-bunzip.o micro-bunzip.o + +micro-bunzip : micro-bunzip.c + $(CC) $(CFLAGS) -DMICRO_BUNZIP_MAIN $< -o $@ + +test: bzip-table seek-bunzip + # Generate 10 megabytes of random data + dd if=/dev/random of=test_random.dat bs=1024k count=4 + # Compress but keep original + bzip2 --force --keep test_random.dat + # Run bzip2recover to build a seperate bz2 file for each block + bzip2recover test_random.dat.bz2 + # Build table + ./bzip-table < test_random.dat.bz2 > test_random.dat.bz2t + # Grab each block using seek-bunzip and compare to recovered block + nl test_random.dat.bz2t | while read num pos size; \ + do \ + bzip2 -d -c < rec0000$${num}test_random.dat.bz2 > test_expected; \ + ./seek-bunzip $${pos} < test_random.dat.bz2 > test_actual; \ + cmp test_expected test_actual; \ + if [ $$? -ne 0 ]; then \ + echo "FAILED: Blocks do not match"; \ + exit 1; \ + fi; \ + done + @echo "SUCCESS!" + +clean: + rm -f *.o $(PROGS) test* rec00* + +format: + astyle --options=astyle.opts *.c *.h |