diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/019/group__g1.xml | 2 | ||||
-rw-r--r-- | testing/019/group__g2.xml | 2 | ||||
-rw-r--r-- | testing/019/group__g3.xml | 2 | ||||
-rw-r--r-- | testing/019_defgroup.c | 2 | ||||
-rw-r--r-- | testing/037/037__msc_8cpp.xml | 27 | ||||
-rw-r--r-- | testing/037/class_receiver.xml | 4 | ||||
-rw-r--r-- | testing/037/class_sender.xml | 4 | ||||
-rw-r--r-- | testing/037_msc.cpp | 18 | ||||
-rw-r--r-- | testing/CMakeLists.txt | 27 | ||||
-rwxr-xr-x | testing/runtests.py | 80 |
10 files changed, 132 insertions, 36 deletions
diff --git a/testing/019/group__g1.xml b/testing/019/group__g1.xml index d6807ca..d9ea16d 100644 --- a/testing/019/group__g1.xml +++ b/testing/019/group__g1.xml @@ -20,9 +20,9 @@ </memberdef> </sectiondef> <briefdescription> - <para>Text for first group. </para> </briefdescription> <detaileddescription> + <para>Text for first group. </para> </detaileddescription> </compounddef> </doxygen> diff --git a/testing/019/group__g2.xml b/testing/019/group__g2.xml index 3514d89..9b1fc83 100644 --- a/testing/019/group__g2.xml +++ b/testing/019/group__g2.xml @@ -21,9 +21,9 @@ </memberdef> </sectiondef> <briefdescription> - <para>Text for second group. </para> </briefdescription> <detaileddescription> + <para>Text for second group. </para> </detaileddescription> </compounddef> </doxygen> diff --git a/testing/019/group__g3.xml b/testing/019/group__g3.xml index 0f21232..d9137b0 100644 --- a/testing/019/group__g3.xml +++ b/testing/019/group__g3.xml @@ -34,9 +34,9 @@ </memberdef> </sectiondef> <briefdescription> - <para>Text for third group. </para> </briefdescription> <detaileddescription> + <para>Text for third group. </para> </detaileddescription> </compounddef> </doxygen> diff --git a/testing/019_defgroup.c b/testing/019_defgroup.c index d42d63e..d7e440e 100644 --- a/testing/019_defgroup.c +++ b/testing/019_defgroup.c @@ -38,7 +38,7 @@ void func_g3(); /** \} */ /** \addtogroup g3 - * \{ + * \{ */ /** Another function added to the third group */ diff --git a/testing/037/037__msc_8cpp.xml b/testing/037/037__msc_8cpp.xml new file mode 100644 index 0000000..3de730d --- /dev/null +++ b/testing/037/037__msc_8cpp.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version=""> + <compounddef id="037__msc_8cpp" kind="file" language="C++"> + <compoundname>037_msc.cpp</compoundname> + <innerclass refid="class_sender" prot="public">Sender</innerclass> + <innerclass refid="class_receiver" prot="public">Receiver</innerclass> + <briefdescription> + </briefdescription> + <detaileddescription> + <para>A bit more complex msc diagram, with also parallel events. <msc> +Sender_1,Receiver_1,Sender1_1, +Sender,Receiver,Sender1, +Sender_2,Receiver_2,Sender1_2; + +Sender_1->Receiver_1 [label="Command()", URL="nref Receiver::Command()"], +Sender1_1<-Receiver_1 [label="Ack()", URL="nref Ack()", ID="1"]; + +Sender->Receiver [label="Command()", URL="nref Receiver::Command()"]; +Sender1<-Receiver [label="Ack()", URL="nref Ack()", ID="1"]; +Sender_2->Receiver_2 [label="Command()", URL="nref Receiver::Command()"], +Sender1_2<-Receiver_2 [label="Ack()", URL="nref Ack()", ID="1"]; +</msc> + </para> + </detaileddescription> + <location file="037_msc.cpp"/> + </compounddef> +</doxygen> diff --git a/testing/037/class_receiver.xml b/testing/037/class_receiver.xml index 24e82fd..b3c9c5a 100644 --- a/testing/037/class_receiver.xml +++ b/testing/037/class_receiver.xml @@ -19,7 +19,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="037_msc.cpp" line="32" column="10"/> + <location file="037_msc.cpp" line="50" column="10"/> </memberdef> </sectiondef> <briefdescription> @@ -32,7 +32,7 @@ </msc> </para> </detaileddescription> - <location file="037_msc.cpp" line="28" column="1" bodyfile="037_msc.cpp" bodystart="29" bodyend="33"/> + <location file="037_msc.cpp" line="46" column="1" bodyfile="037_msc.cpp" bodystart="47" bodyend="51"/> <listofallmembers> <member refid="class_receiver_1a162099741e0324e6254c9bc570566e40" prot="public" virt="non-virtual"> <scope>Receiver</scope> diff --git a/testing/037/class_sender.xml b/testing/037/class_sender.xml index 525ab0a..14f29d1 100644 --- a/testing/037/class_sender.xml +++ b/testing/037/class_sender.xml @@ -19,7 +19,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="037_msc.cpp" line="17" column="10"/> + <location file="037_msc.cpp" line="35" column="10"/> </memberdef> </sectiondef> <briefdescription> @@ -32,7 +32,7 @@ </msc> </para> </detaileddescription> - <location file="037_msc.cpp" line="13" column="1" bodyfile="037_msc.cpp" bodystart="14" bodyend="18"/> + <location file="037_msc.cpp" line="31" column="1" bodyfile="037_msc.cpp" bodystart="32" bodyend="36"/> <listofallmembers> <member refid="class_sender_1a8ad2c6f9baa4e798868fe4a4d45f8fda" prot="public" virt="non-virtual"> <scope>Sender</scope> diff --git a/testing/037_msc.cpp b/testing/037_msc.cpp index 84ffc55..a3c0e4b 100644 --- a/testing/037_msc.cpp +++ b/testing/037_msc.cpp @@ -1,6 +1,24 @@ // objective: test the \msc and \endmsc commands // check: class_sender.xml // check: class_receiver.xml +// check: 037__msc_8cpp.xml + +/** \file + * A bit more complex msc diagram, with also parallel events. + * \msc + * Sender_1,Receiver_1,Sender1_1, + * Sender,Receiver,Sender1, + * Sender_2,Receiver_2,Sender1_2; + * + * Sender_1->Receiver_1 [label="Command()", URL="nref Receiver::Command()"], + * Sender1_1<-Receiver_1 [label="Ack()", URL="nref Ack()", ID="1"]; + * + * Sender->Receiver [label="Command()", URL="nref Receiver::Command()"]; + * Sender1<-Receiver [label="Ack()", URL="nref Ack()", ID="1"]; + * Sender_2->Receiver_2 [label="Command()", URL="nref Receiver::Command()"], + * Sender1_2<-Receiver_2 [label="Ack()", URL="nref Ack()", ID="1"]; + * \endmsc + */ /** Sender class. Can be used to send a command to the server. * The receiver will acknowledge the command by calling Ack(). diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index 40cb40b..1851c9f 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -1,9 +1,24 @@ +# run all tests sequentially (keep for backward compatibilty) add_custom_target(tests - COMMENT "Running doxygen tests..." - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --doxygen ${PROJECT_BINARY_DIR}/bin/doxygen --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing - DEPENDS doxygen -) -add_test(NAME suite - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --doxygen $<TARGET_FILE:doxygen> --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing + COMMENT "Running doxygen tests..." + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --doxygen ${PROJECT_BINARY_DIR}/bin/doxygen --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing + DEPENDS doxygen ) +# get the files in the testing directory starting with 3 digits and an underscore +if (${CMAKE_VERSION} VERSION_EQUAL "3.11.0" OR ${CMAKE_VERSION} VERSION_GREATER "3.11.0") + file(GLOB TEST_FILES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/[0-9][0-9][0-9]_*.*") +else() + file(GLOB TEST_FILES "${CMAKE_CURRENT_SOURCE_DIR}/[0-9][0-9][0-9]_*.*") +endif() + +foreach(TEST_FILE ${TEST_FILES}) + # extract the test name from the file name + string(REGEX REPLACE "^.*/([0-9][0-9][0-9]*.*)\\.[^.]*$" "\\1" TEST_NAME "${TEST_FILE}") + # extract the test id from the file name + string(REGEX REPLACE "^.*/([0-9][0-9][0-9]*).*$" "\\1" TEST_ID "${TEST_FILE}") + # add a test target for each test + add_test(NAME ${TEST_NAME} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --id ${TEST_ID} --doxygen $<TARGET_FILE:doxygen> --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing + ) +endforeach() diff --git a/testing/runtests.py b/testing/runtests.py index 10fe502..6b3e54e 100755 --- a/testing/runtests.py +++ b/testing/runtests.py @@ -150,11 +150,11 @@ class Tester: if (self.args.clang): print('CLANG_ASSISTED_PARSING=YES', file=f) if (self.args.cfgs): - for cfg in list(itertools.chain.from_iterable(self.args.cfgs)): - if cfg.find('=') == -1: + for cfg in self.args.cfgs: + if cfg[0].find('=') == -1: print("Not a doxygen configuration item, missing '=' sign: '%s'."%cfg) sys.exit(1) - print(cfg, file=f) + print(cfg[0], file=f) if 'check' not in self.config or not self.config['check']: print('Test doesn\'t specify any files to check') @@ -183,7 +183,7 @@ class Tester: # check if the file we need to check is actually generated if not os.path.isfile(check_file): print('Non-existing file %s after \'check:\' statement' % check_file) - return + return False # convert output to canonical form data = xpopen('%s --format --noblanks --nowarning %s' % (self.args.xmllint,check_file)) if data: @@ -191,12 +191,13 @@ class Tester: data = re.sub(r'xsd" version="[0-9.-]+"','xsd" version=""',data).rstrip('\n') else: print('Failed to run %s on the doxygen output file %s' % (self.args.xmllint,self.test_out)) - return + return False out_file='%s/%s' % (self.test_out,check) with xopen(out_file,'w') as f: print(data,file=f) shutil.rmtree(self.test_out+'/out',ignore_errors=True) os.remove(self.test_out+'/Doxyfile') + return True # check the relevant files of a doxygen run with the reference material def perform_test(self,testmgr): @@ -366,10 +367,13 @@ class Tester: if (self.args.pdf): failed_latex=False latex_output='%s/latex' % self.test_out + # with languages like Hungarian we had problems with some tests on windows when stderr was used. if (sys.platform == 'win32'): + outType=False redirl='>nul: 2>temp' mk='make.bat' else: + outType=True redirl='>/dev/null 2>temp' mk='make' cur_directory = os.getcwd() @@ -377,34 +381,43 @@ class Tester: exe_string = mk exe_string1 = exe_string exe_string += ' %s' % (redirl) - exe_string += ' %s more temp' % (separ) - latex_out = xpopen(exe_string,exe_string1,getStderr=True) + if outType: + exe_string += ' %s more temp' % (separ) + latex_out = xpopen(exe_string,exe_string1,getStderr=outType) os.chdir(cur_directory); - if latex_out.find("Error")!=-1: + if (outType and latex_out.find("Error")!=-1): msg += ("PDF generation failed\n For a description of the problem see 'refman.log' in the latex directory of this test",) - failed_html=True - elif xopen(latex_output + "/refman.log",'r').read().find("Error")!= -1: + failed_latex=True + elif (not outType and xopen(latex_output + "/temp",'r').read().find("Error")!= -1): msg += ("PDF generation failed\n For a description of the problem see 'refman.log' in the latex directory of this test",) - failed_html=True - elif xopen(latex_output + "/refman.log",'r').read().find("Emergency stop")!= -1: + failed_latex=True + elif xopen(latex_output + "/refman.log",'r',encoding='ISO-8859-1').read().find("Error")!= -1: msg += ("PDF generation failed\n For a description of the problem see 'refman.log' in the latex directory of this test",) - failed_html=True + failed_latex=True + elif xopen(latex_output + "/refman.log",'r',encoding='ISO-8859-1').read().find("Emergency stop")!= -1: + msg += ("PDF generation failed\n For a description of the problem see 'refman.log' in the latex directory of this test",) + failed_latex=True elif not self.args.keep: shutil.rmtree(latex_output,ignore_errors=True) if failed_xml or failed_html or failed_latex or failed_docbook or failed_rtf or failed_xmlxsd: testmgr.ok(False,self.test_name,msg) - return + return False testmgr.ok(True,self.test_name) if not self.args.keep: shutil.rmtree(self.test_out,ignore_errors=True) + return True def run(self,testmgr): if self.update: - self.update_test(testmgr) + return self.update_test(testmgr) else: - self.perform_test(testmgr) + return self.perform_test(testmgr) + +def do_generation_work(test): + tester = Tester(test[0].args,test[1]) + return tester.run(test[0]) class TestManager: def __init__(self,args,tests): @@ -419,10 +432,10 @@ class TestManager: def ok(self,result,test_name,msg='Ok'): if result: - print('ok %s - %s' % (self.count,test_name)) + print('ok - %s' % (test_name)) self.passed = self.passed + 1 else: - print('not ok %s - %s' % (self.count,test_name)) + print('not ok - %s' % (test_name)) print('-------------------------------------') for o in msg: print(o) @@ -437,9 +450,20 @@ class TestManager: return 0 if self.passed==self.num_tests else 1 def perform_tests(self): - for test in self.tests: - tester = Tester(self.args,test) - tester.run(self) + if (self.args.pool == 1): + passed = 0 + for test in self.tests: + tester = Tester(self.args,test) + passed += tester.run(self) + self.passed = passed + else: + dl = [] + for test in self.tests: + dl += [(self, test)] + import multiprocessing as mp + p = mp.Pool(processes=self.args.pool) + passed = p.map(do_generation_work, dl) + self.passed = sum(passed) res=self.result() if self.args.xhtml and self.args.inputdir!='.' and not res and not self.args.keep: shutil.rmtree("dtd",ignore_errors=True) @@ -450,6 +474,14 @@ class TestManager: shutil.rmtree("dtd",ignore_errors=True) shutil.copytree(self.args.inputdir+"/dtd", "dtd") +def split_and_keep(s,sep): + s = s.replace(sep,'\0'+sep) # add token separator + s = s.split('\0') # split by null delimiter + s = [x.strip() for x in filter(None,s)] # strip and remove empty elements + s = [z.split(' ',1) for z in s] # split by first space + s = [i for ss in s for i in ss] # flatten the list + return s + def main(): # argument handling parser = argparse.ArgumentParser(description='run doxygen tests') @@ -476,6 +508,8 @@ def main(): 'output directory to write the doxygen output to') parser.add_argument('--noredir',help= 'disable redirection of doxygen warnings',action="store_true") + parser.add_argument('--pool',nargs='?',default='1',type=int,help= + 'pool size of multiprocess tests') parser.add_argument('--xml',help='create xml output and check', action="store_true") parser.add_argument('--rtf',help= @@ -498,7 +532,9 @@ def main(): parser.add_argument('--cfg',nargs='+',dest='cfgs',action='append',help= 'run test with extra doxygen configuration settings ' '(the option may be specified multiple times') - test_flags = os.getenv('TEST_FLAGS', default='').split() + + test_flags = split_and_keep(os.getenv('TEST_FLAGS', default=''), '--') + args = parser.parse_args(test_flags + sys.argv[1:]) # sanity check |