Merge lp:~zorba-coders/zorba/bug-874679-add-test-directory into lp:zorba

Proposed by Chris Hillery
Status: Merged
Approved by: Juan Zacarias
Approved revision: 10770
Merged at revision: 10772
Proposed branch: lp:~zorba-coders/zorba/bug-874679-add-test-directory
Merge into: lp:zorba
Diff against target: 140 lines (+83/-23)
2 files modified
cmake_modules/ZorbaModule.cmake (+82/-22)
modules/ExternalModules.conf (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-874679-add-test-directory
Reviewer Review Type Date Requested Status
Juan Zacarias Approve
Chris Hillery Approve
Review via email: mp+102268@code.launchpad.net

Commit message

Improve "known-crashing test" list support in ADD_TEST_DIRECTORY(): only skip such tests on Win32, otherwise use EXPECTED_FAILURE(). Also raise an error if an unknown test is passed to this macro.

To post a comment you must log in.
Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-874679-add-test-directory-2012-04-17T10-03-56.024Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve, 1 Pending.

Revision history for this message
Juan Zacarias (juan457) :
review: Approve
Revision history for this message
Juan Zacarias (juan457) :
review: Needs Resubmitting
Revision history for this message
Juan Zacarias (juan457) wrote :

srry I approved it thinking it was another branch, I am checking the changes and will approve as soon as I check all you mentioned in the email

10770. By Chris Hillery

Update image module to tag "1.0".

Revision history for this message
Juan Zacarias (juan457) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-874679-add-test-directory-2012-04-17T22-10-56.313Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake_modules/ZorbaModule.cmake'
2--- cmake_modules/ZorbaModule.cmake 2012-04-16 20:56:43 +0000
3+++ cmake_modules/ZorbaModule.cmake 2012-04-17 21:53:23 +0000
4@@ -629,41 +629,101 @@
5
6 ENDMACRO(expected_failure)
7
8-# Convenience macro for adding tests in a standard format.
9+# Convenience macro for adding tests in a standard format. All test
10+# cases (.xq files) in "Queries" subdirectory of the named directory
11+# will be automatically added for CTest. Each test will be named
12+# ${PROJECT_NAME}/<filename>, where <filename> is the path relative to
13+# the Queries/ subdirectory.
14+#
15+# The optional second argument exists for Windows. Normally,
16+# EXPECTED_FAILURE() can be used even for tests that crash
17+# (segfault). However, on Windows, when a test crashes, it pops up a
18+# dialog box. This prevents tests running unattended. Since it is not
19+# possible with CMake to remove a test once added,
20+# ADD_TEST_DIRECTORY() needs to be told not to add the test at all on
21+# Windows platforms. Therefore, after the directory name, you may
22+# additional arguments in the form (testname bugnumber testname
23+# bugnumber ...) to ADD_TEST_DIRECTORY(). On Windows, the named tests
24+# will be skipped entirely. On other platforms, they will be passed to
25+# EXPECTED_FAILURE() with the corresponding bug number.
26+#
27+# This second argument should only be used for test cases that are
28+# currently *crashing* on Windows. If the test is simply failing, then
29+# you should use EXPECTED_FAILURE() after calling ADD_TEST_DIRECTORY().
30+#
31 # Parameters:
32 # TEST_DIR - all the .xq files in this directory will be added as tests
33-# ARGV1 - if this is present, it will be interpreted as a list of
34-# exceptions. The list items will be removed from the list of
35-# files found in TEST_DIR.
36+# (additional args) - expected crashing tests, as discussed above.
37 MACRO (ADD_TEST_DIRECTORY TEST_DIR)
38 # QQQ error-check: Queries directory exists, some tests found...
39 FILE(GLOB_RECURSE TESTFILES FOLLOW_SYMLINKS
40 RELATIVE "${TEST_DIR}/Queries" "${TEST_DIR}/Queries/*.xq")
41
42- FOREACH (EXCEPTION ${ARGV1})
43- LIST (REMOVE_ITEM TESTFILES ${EXCEPTION})
44- ENDFOREACH (EXCEPTION)
45+ # Convert extra arguments to two lists: test names and bug IDs
46+ SET (crash_tests)
47+ SET (crash_bugids)
48+ SET (known_crashes ${ARGN})
49+ LIST (LENGTH known_crashes num_crashes)
50+ WHILE (num_crashes GREATER 0)
51+ LIST (GET known_crashes 0 _testcase)
52+ LIST (APPEND crash_tests ${_testcase})
53+ LIST (GET known_crashes 1 _bugid)
54+ LIST (APPEND crash_bugids ${_bugid})
55+ LIST (REMOVE_AT known_crashes 0 1)
56+ MATH (EXPR num_crashes "${num_crashes} - 2")
57+ ENDWHILE (num_crashes GREATER 0)
58
59+ IF(WIN32)
60+ SET(PATH_SEP ",")
61+ ELSE(WIN32)
62+ SET(PATH_SEP ":")
63+ ENDIF(WIN32)
64 SET(TESTCOUNTER 0)
65 FOREACH(TESTFILE ${TESTFILES})
66 SET(TESTNAME "${PROJECT_NAME}/${TESTFILE}")
67
68- IF(WIN32)
69- SET(PATH_SEP ",")
70- ELSE(WIN32)
71- SET(PATH_SEP ":")
72- ENDIF(WIN32)
73- ADD_TEST(${TESTNAME} "${Zorba_TESTDRIVER}"
74- "--rbkt-src" "${TEST_DIR}"
75- "--module-path" "${CMAKE_BINARY_DIR}/URI_PATH/${PATH_SEP}${SECONDARY_MODULE_PATHS}"
76- "${TESTFILE}")
77-
78- MATH(EXPR TESTCOUNTER ${TESTCOUNTER}+1)
79- MATH(EXPR TESTMOD "${TESTCOUNTER}%100")
80- IF (${TESTMOD} EQUAL 0)
81- MESSAGE(STATUS "Adding another 100 Tests")
82- ENDIF (${TESTMOD} EQUAL 0)
83+ # See if this test is in the known-crashing list
84+ SET (_crash_bugid)
85+ LIST (FIND crash_tests ${TESTNAME} _crash_idx)
86+ IF (${_crash_idx} GREATER -1)
87+ # Get corresponding bug ID
88+ LIST (GET crash_bugids ${_crash_idx} _crash_bugid)
89+ # Remove from known-crashing list
90+ LIST (REMOVE_AT crash_tests ${_crash_idx})
91+ ENDIF (${_crash_idx} GREATER -1)
92+
93+ # On Windows, skip calling ADD_TEST() for any known crashing tests
94+ IF (WIN32 AND (${_crash_idx} GREATER -1) )
95+ MESSAGE (STATUS "WARNING: Skipping test case ${TESTNAME} which is expected to crash - bug ${_crash_bugid}")
96+ ELSE (WIN32 AND (${_crash_idx} GREATER -1) )
97+ ADD_TEST(${TESTNAME} "${Zorba_TESTDRIVER}"
98+ "--rbkt-src" "${TEST_DIR}"
99+ "--module-path"
100+ "${CMAKE_BINARY_DIR}/URI_PATH/${PATH_SEP}${SECONDARY_MODULE_PATHS}"
101+ "${TESTFILE}")
102+
103+ # On non-Windows, call EXPECTED_FAILURE() for known crashes
104+ IF (${_crash_idx} GREATER -1)
105+ MESSAGE (STATUS "Marking test case ${TESTNAME} as expected to crash - bug ${bugid}")
106+ EXPECTED_FAILURE (${TESTNAME} ${_bugid})
107+ ENDIF (${_crash_idx} GREATER -1)
108+
109+ MATH(EXPR TESTCOUNTER ${TESTCOUNTER}+1)
110+ MATH(EXPR TESTMOD "${TESTCOUNTER}%100")
111+ IF (${TESTMOD} EQUAL 0)
112+ MESSAGE(STATUS "Adding another 100 Tests")
113+ ENDIF (${TESTMOD} EQUAL 0)
114+
115+ ENDIF (WIN32 AND (${_crash_idx} GREATER -1) )
116+
117 ENDFOREACH(TESTFILE)
118+
119+ # Ensure that known-crashes list is empty - otherwise some tests were
120+ # named that didn't exist
121+ IF (NOT "${crash_tests}" STREQUAL "")
122+ MESSAGE (FATAL_ERROR "The following non-existing test cases were passed to ADD_TEST_DIRECTORY(): ${crash_tests}")
123+ ENDIF (NOT "${crash_tests}" STREQUAL "")
124+
125 MESSAGE(STATUS "Added ${TESTCOUNTER} tests in ${TEST_DIR}")
126 ENDMACRO (ADD_TEST_DIRECTORY)
127
128
129=== modified file 'modules/ExternalModules.conf'
130--- modules/ExternalModules.conf 2012-04-16 20:56:43 +0000
131+++ modules/ExternalModules.conf 2012-04-17 21:53:23 +0000
132@@ -32,7 +32,7 @@
133 excel bzr lp:zorba/excel-module zorba-2.2
134 geo bzr lp:zorba/geo-module zorba-2.2
135 http-client bzr lp:zorba/http-client-module zorba-2.2
136-image bzr lp:zorba/image-module zorba-2.2
137+image bzr lp:zorba/image-module 1.0
138 languages bzr lp:zorba/languages-module zorba-2.2
139 oauth bzr lp:zorba/oauth-module zorba-2.2
140 process bzr lp:zorba/process-module zorba-2.2

Subscribers

People subscribed via source and target branches