Commit e988e1ff authored by admuc's avatar admuc

diverse updates

parent 6f928a65
#!/usr/bin/env python3
"""Creates pickled tuple of output of 'testcases'
(c) 2018 by Berthold Gehrke <berthold.gehrke@gmail.com>
License: GNU General Public License v2 or higher (GPLv2+)"""
import argparse
import os
import pickle
RELEASEVERSION = "v303"
PARSER = argparse.ArgumentParser()
PARSER.add_argument("-v", "--verbose", help="increase output verbosity",
action="store_true")
ARGS = PARSER.parse_args()
if ARGS.verbose:
print("verbosity turned on")
def pickle_testcases_output():
"""look for output and pickle"""
output_list = [item for item in os.listdir("../../data/") if \
not (item.endswith('.txt') or item.endswith('.conf') or 'image' in item)]
if ARGS.verbose:
print(output_list)
print(len(output_list))
return tuple(output_list)
with open(RELEASEVERSION + '.dat', 'wb', 3) as f:
pickle.dump(pickle_testcases_output(), f)
This diff is collapsed.
AsciiDoc3 More_Tests README
======================================
This is just experiemental, do not use!
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/env python3
"""produces testcases of current version AsciiDoc3 using multiprocessing.
Writes output to /dev/shm/current/*.* (that means: in memory)
Needs configuration of testcases already pickled; see
'./pickled_data/testconf3pickle.py' and './pickled_data/testconf3pickle.dat'
We have to set 'imagesdir' explicitly.
Sample of testconf-item:
{'options': (('--doctype', 'book'),),
'attributes': (('toc', True),),
'outfile': '/dev/shm/current/lang-it-book-test-html5.html',
'backend': 'html5',
'inputfile': '~/asciidoc3/tests/data/lang-it-test.txt'}
(c) 2018 Berthold Gehrke <berthold.gehrke@gmail.com>
Free use is granted under the terms of GPLv2+
"""
from concurrent import futures
import os.path
import pickle
#import pprint
from sys import platform
from shutil import rmtree
import subprocess
def remove_and_mkdir_shm_current():
"""all remainder (if any) of previous testing in /dev/shm/current are removed,
and a new directory is created"""
if os.path.exists("/dev/shm/current") and os.path.isdir("/dev/shm/current"):
rmtree("/dev/shm/current")
os.mkdir("/dev/shm/current")
print("remove_and_mkdir_shm_current() ... done")
def reading_testconf():
"""compute tuple(testtuple). Every item in testtuple
is a dict. """
testconf3pickle = os.path.abspath('./pickled_data/testconf3pickle.dat')
with open(testconf3pickle, 'rb', 3) as test_conf_file:
testtuple = tuple(pickle.load(test_conf_file))
#pprint.print(testtuple)
#print("len(testtuple): ", len(testtuple))
print("unpickle testtuple ... done")
return testtuple
def create_testcases(itemrow):
"""text here"""
inputfile = itemrow['inputfile']
optionslist = list()
optionslist.append('-b')
optionslist.append(itemrow['backend'])
if itemrow['options']:
for optionpair in itemrow['options']:
optionslist.append(optionpair[0])
if optionpair[1]:
optionslist.append(optionpair[1])
if itemrow['attributes']:
for attrpair in itemrow['attributes']:
optionslist.append('-a')
if attrpair[1] is None:
attr = attrpair[0] + '="None"'
elif attrpair[1] is True:
attr = attrpair[0] + '="True"'
else:
attr = attrpair[0] + '=' + attrpair[1]
optionslist.append(attr)
outputfile = itemrow['outfile']
optionslist.extend(["-o", outputfile])
#set imagedir
explicit_imagedir = os.path.abspath('../../images')
optionslist.extend(["-a", "imagesdir=" + explicit_imagedir])
commandline = list()
commandline.append("python3")
ad3_executable = os.path.abspath("../../asciidoc3.py")
commandline.append(ad3_executable)
commandline.extend(optionslist)
commandline.append(inputfile)
#print()
#print("subprocess starts with the following commadline: ")
#print(commandline)
subprocess_testcase = subprocess.run(commandline, stderr=subprocess.PIPE)
if subprocess_testcase.returncode:
print("[WARNING] Returncode =", subprocess_testcase.returncode, \
"processing inputfile", itemrow['inputfile'])
print()
if __name__ == "__main__":
# do not run as an imported module or using an IDE like IDLE
if not platform.lower().startswith('linux'):
exit("Sorry, at this time only GNU/Linux!")
remove_and_mkdir_shm_current()
TUPLE_TEST = reading_testconf()
with futures.ProcessPoolExecutor(max_workers=4) as e:
for item in TUPLE_TEST:
e.submit(create_testcases, item)
print("writing testcases ... done")
This diff is collapsed.
This diff is collapsed.
AsciiDoc3 Tests README
======================================
= AsciiDoc3 Tests README
To test the features of AsciiDoc3, please use the information given in the 'userguide',
the 'quickstart', and the files in directory ../doc.
the 'quickstart', and the files in directory ../doc of the distribution.
Previous versions of AsciiDoc(3) provided some software tests in the directory 'tests'.
They were used mainly by developers - and only sporadicly by 'real world' users.
So this directory is empty, you can find the relevant (partly new implemented) tests
and unittests by and by in the online repo, see on a daily basis asciidoc3.org. The
tests will be added again to one of the next releases.
[NOTE]
You may safely remove directory 'tests' (and subfolders - if any -) and the entire data
they contain. This will *not* have any effect on the execution of AsciiDoc3!
Most users are happy to see AsciiDoc3 work in the expected way, and so it does! If you like
to see even more examples of the power of AsciiDoc3, try this:
-------------------
cd ~/asciidoc3/tests
python3 testasciidoc3.py --force update
-------------------
You'll see something like this on stdout:
-------------------
WRITING: data/testcases-html4.html
WRITING: data/testcases-xhtml11.html
WRITING: data/testcases-docbook.xml
WRITING: data/testcases-html5.html
WRITING: data/filters-test-html4.html
...
WRITING: data/rcs-id-marker-test-docbook.xml
WRITING: data/rcs-id-marker-test-html5.html
WRITING: data/deprecated-quotes-html4.html
WRITING: data/deprecated-quotes-xhtml11.html
WRITING: data/deprecated-quotes-docbook.xml
WRITING: data/deprecated-quotes-html5.html
-------------------
Change to ./data and check out the multi-faceted 170 files computed by AsciiDoc3.
They underline the capabilities of the program.
Beside the new files in ./data there are a few generated md5/png in ../images.
== Usage
If you like to develop and test your own asciidoc3.py (or the conf-files, respectively), you can test the output
with the help of 'testasciidoc3.py', too:
--------------
python3 testasciidoc3.py
--------------
gives you the 'usage'
----------------
Usage: testasciidoc3.py [OPTIONS] COMMAND
Run AsciiDoc3 conformance tests specified in configuration FILE.
Commands:
list List tests
run [NUMBER] [BACKEND] Execute tests
update [NUMBER] [BACKEND] Regenerate and update test data
Options:
-f, --conf-file=CONF_FILE
Use configuration file CONF_FILE (default configuration file is
testasciidoc3.conf in testasciidoc3.py directory)
--force
Update all test data overwriting existing data
----------------
== List
So we have:
----------------
python3 testasciidoc3.py list
1: Test cases
2: Filters
3: Tables
4: Source highlighter
5: Example article
6: Example article with embedded images (data URIs)
7: Example article with included docinfo file.
8: Example book
9: Example multi-part book
10: Man page
11: Example slideshow
12: ASCIIMathML
13: LaTeXMathML
14: LaTeX Math
15: LaTeX Filter
16: UTF-8 Examples
17: Additional Open Block and Paragraph styles
18: English language file (article)
19: English language file (book)
20: English language file (manpage)
21: Russian language file (article)
22: Russian language file (book)
23: Russian language file (manpage)
24: French language file (article)
25: French language file (book)
26: French language file (manpage)
27: German language file (article)
28: German language file (book)
29: German language file (manpage)
30: Hungarian language file (article)
31: Hungarian language file (book)
32: Hungarian language file (manpage)
33: Spanish language file (article)
34: Spanish language file (book)
35: Spanish language file (manpage)
36: Brazilian Portuguese language file (article)
37: Brazilian Portuguese language file (book)
38: Brazilian Portuguese language file (manpage)
39: Ukrainian language file (article)
40: Ukrainian language file (book)
41: Ukrainian language file (manpage)
42: Dutch language file (article)
43: Dutch language file (book)
44: Dutch language file (manpage)
45: Italian language file (article)
46: Italian language file (book)
47: Italian language file (manpage)
48: Czech language file (article)
49: Czech language file (book)
50: Czech language file (manpage)
51: Romanian language file (article)
52: Romanian language file (book)
53: Romanian language file (manpage)
54: RCS $Id$ marker test
55: # UTF-8 BOM test
----------------------------
or, as an example
== Run
----------------------------
python3 testasciidoc3.py run 27
27: German language file (article)
SOURCE: asciidoc3: data/lang-de-test.txt
SKIPPED: docbook: data/lang-de-article-test-docbook.xml
SKIPPED: xhtml11: data/lang-de-article-test-xhtml11.html
SKIPPED: html4: data/lang-de-article-test-html4.html
SKIPPED: html5: data/lang-de-article-test-html5.html
TOTAL SKIPPED: 4
-----------------------------
'TOTAL SKIPPED' pops up because testasciidoc3.py first needs to generate the output to compare
with 'testasciidoc3.py run':
== Update
----------------------------
python3 testasciidoc3.py update 27 xhtml11
WRITING: data/lang-de-article-test-xhtml11.html
----------------------------
Now it works as expected:
----------------------------
python3 testasciidoc3.py run 27 xhtml11
27: German language file (article)
SOURCE: asciidoc3: data/lang-de-test.txt
PASSED: xhtml11: data/lang-de-article-test-xhtml11.html
TOTAL PASSED: 1
-----------------------------
With this information feel free to perform your own test series ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment