Test rig cleanup.

pull/1/head
Yusuke Shinyama 2014-06-15 11:41:30 +09:00
parent a8ec99a848
commit 8f9c4dedff
3 changed files with 53 additions and 65 deletions

View File

@ -5,5 +5,4 @@ python:
install: install:
- pip install pycrypto - pip install pycrypto
script: script:
- make unittest
- make test - make test

View File

@ -63,4 +63,4 @@ test: cmap
pdfminer/rijndael.py pdfminer/rijndael.py
$(PYTHON) pdfminer/ccitt.py $(PYTHON) pdfminer/ccitt.py
$(PYTHON) pdfminer/psparser.py $(PYTHON) pdfminer/psparser.py
cd samples && $(MAKE) clean test cd samples && $(MAKE) test

View File

@ -2,78 +2,67 @@
RM=rm -f RM=rm -f
CMP=: CMP=:
ECHO=echo
PYTHON=python2 PYTHON=python2
PDF2TXT=PYTHONPATH=.. $(PYTHON) ../tools/pdf2txt.py -p1 -V PDF2TXT=PYTHONPATH=.. $(PYTHON) ../tools/pdf2txt.py -p1 -V
HTMLS=$(HTMLS_FREE) $(HTMLS_NONFREE) FREE= \
HTMLS_FREE= \ simple1 \
simple1.html \ simple2 \
simple2.html \ simple3 \
simple3.html \ jo
jo.html
HTMLS_NONFREE= \
nonfree/dmca.html \
nonfree/f1040nr.html \
nonfree/i1040nr.html \
nonfree/kampo.html \
nonfree/naacl06-shinyama.html \
nonfree/nlp2004slides.html
TEXTS=$(TEXTS_FREE) $(TEXTS_NONFREE) NONFREE= \
TEXTS_FREE= \ nonfree/dmca \
simple1.txt \ nonfree/f1040nr \
simple2.txt \ nonfree/i1040nr \
simple3.txt \ nonfree/kampo \
jo.txt nonfree/naacl06-shinyama \
TEXTS_NONFREE= \ nonfree/nlp2004slides
nonfree/dmca.txt \
nonfree/f1040nr.txt \
nonfree/i1040nr.txt \
nonfree/kampo.txt \
nonfree/naacl06-shinyama.txt \
nonfree/nlp2004slides.txt
XMLS=$(XMLS_FREE) $(XMLS_NONFREE) TESTS=$(FREE) $(NONFREE)
XMLS_FREE= \
simple1.xml \
simple2.xml \
simple3.xml \
jo.xml
XMLS_NONFREE= \
nonfree/dmca.xml \
nonfree/f1040nr.xml \
nonfree/i1040nr.xml \
nonfree/kampo.xml \
nonfree/naacl06-shinyama.xml \
nonfree/nlp2004slides.xml
all: htmls texts xmls CRYPT_PASS1=foo
CRYPT_PASS2=baz
CRYPT_BASE=encryption/base
CRYPTS= \
encryption/rc4-40 \
encryption/rc4-128 \
encryption/aes-128 \
encryption/aes-128-m \
encryption/aes-256 \
encryption/aes-256-m
all: tests crypts
tests:
for i in $(TESTS); do \
$(ECHO) $$i; \
$(PDF2TXT) -t html -o $$i.html $$i.pdf; \
$(CMP) $$i.html $$i.html.ref; \
$(PDF2TXT) -t xml -o $$i.xml $$i.pdf; \
$(CMP) $$i.xml $$i.xml.ref; \
$(PDF2TXT) -t text -o $$i.txt $$i.pdf; \
$(CMP) $$i.txt $$i.txt.ref; \
done
crypts:
for i in $(CRYPTS); do \
$(ECHO) $$i; \
$(PDF2TXT) -t xml -P $(CRYPT_PASS1) -o $$i.1.xml $$i.pdf; \
$(CMP) $$i.1.xml $(CRYPT_BASE).xml; \
$(PDF2TXT) -t xml -P $(CRYPT_PASS2) -o $$i.2.xml $$i.pdf; \
$(CMP) $$i.2.xml $(CRYPT_BASE).xml; \
done
test: test:
$(MAKE) all CMP=cmp $(MAKE) all CMP=cmp
cd encryption && $(MAKE) test
clean: clean:
-$(RM) $(HTMLS) -for i in $(TESTS); do \
-$(RM) $(TEXTS) $(RM) $$i.html $$i.xml $$i.txt; \
-$(RM) $(XMLS) done
cd encryption && $(MAKE) clean -for i in $(CRYPTS); do \
$(RM) $$i.1.xml $$i.2.xml; \
htmls: $(HTMLS) done
texts: $(TEXTS)
xmls: $(XMLS)
.SUFFIXES: .pdf .html .xml .txt
.pdf.html:
$(PDF2TXT) -t html -o $@ $<
$(CMP) $@ $@.ref
.pdf.xml:
$(PDF2TXT) -t xml -o $@ $<
$(CMP) $@ $@.ref
.pdf.txt:
$(PDF2TXT) -t text -o $@ $<
$(CMP) $@ $@.ref