Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
80c2451a
Commit
80c2451a
authored
Feb 20, 2016
by
Wenzel Jakob
Browse files
use relaxed testing scheme for MSVC and the intel compiler (they miss some RV optimizations)
parent
d6e4cef6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
CMakeLists.txt
CMakeLists.txt
+5
-0
example/run_test.py
example/run_test.py
+9
-1
No files found.
CMakeLists.txt
View file @
80c2451a
...
@@ -202,7 +202,12 @@ elseif (UNIX)
...
@@ -202,7 +202,12 @@ elseif (UNIX)
endif
()
endif
()
enable_testing
()
enable_testing
()
set
(
RUN_TEST
${
PYTHON_EXECUTABLE
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/example/run_test.py
)
set
(
RUN_TEST
${
PYTHON_EXECUTABLE
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/example/run_test.py
)
if
(
MSVC OR CMAKE_CXX_COMPILER_ID MATCHES
"Intel"
)
set
(
RUN_TEST
${
RUN_TEST
}
--relaxed
)
endif
()
foreach
(
i RANGE
${
PYBIND11_FIRSTEXAMPLE
}
${
PYBIND11_LASTEXAMPLE
}
)
foreach
(
i RANGE
${
PYBIND11_FIRSTEXAMPLE
}
${
PYBIND11_LASTEXAMPLE
}
)
add_test
(
NAME example
${
i
}
COMMAND
${
RUN_TEST
}
example
${
i
}
)
add_test
(
NAME example
${
i
}
COMMAND
${
RUN_TEST
}
example
${
i
}
)
endforeach
()
endforeach
()
...
...
example/run_test.py
View file @
80c2451a
...
@@ -8,6 +8,7 @@ remove_long_marker = re.compile(r'([0-9])L')
...
@@ -8,6 +8,7 @@ remove_long_marker = re.compile(r'([0-9])L')
remove_hex
=
re
.
compile
(
r
'0x[0-9a-fA-F]+'
)
remove_hex
=
re
.
compile
(
r
'0x[0-9a-fA-F]+'
)
shorten_floats
=
re
.
compile
(
r
'([1-9][0-9]*\.[0-9]{4})[0-9]*'
)
shorten_floats
=
re
.
compile
(
r
'([1-9][0-9]*\.[0-9]{4})[0-9]*'
)
relaxed
=
False
def
sanitize
(
lines
):
def
sanitize
(
lines
):
lines
=
lines
.
split
(
'
\n
'
)
lines
=
lines
.
split
(
'
\n
'
)
...
@@ -26,7 +27,7 @@ def sanitize(lines):
...
@@ -26,7 +27,7 @@ def sanitize(lines):
line
=
line
.
replace
(
'example.EMode'
,
'EMode'
)
line
=
line
.
replace
(
'example.EMode'
,
'EMode'
)
line
=
line
.
replace
(
'method of builtins.PyCapsule instance'
,
''
)
line
=
line
.
replace
(
'method of builtins.PyCapsule instance'
,
''
)
line
=
line
.
strip
()
line
=
line
.
strip
()
if
sys
.
platform
==
'win32'
:
if
relaxed
:
lower
=
line
.
lower
()
lower
=
line
.
lower
()
# The precise pattern of allocations and deallocations is dependent on the compiler
# The precise pattern of allocations and deallocations is dependent on the compiler
# and optimization level, so we unfortunately can't reliably check it in this kind of test case
# and optimization level, so we unfortunately can't reliably check it in this kind of test case
...
@@ -45,6 +46,13 @@ path = os.path.dirname(__file__)
...
@@ -45,6 +46,13 @@ path = os.path.dirname(__file__)
if
path
!=
''
:
if
path
!=
''
:
os
.
chdir
(
path
)
os
.
chdir
(
path
)
if
len
(
sys
.
argv
)
<
2
:
print
(
"Syntax: %s <example> [--relaxed]"
%
sys
.
argv
[
0
])
exit
(
0
)
if
len
(
sys
.
argv
)
==
3
and
sys
.
argv
[
2
]
==
'--relaxed'
:
relaxed
=
True
name
=
sys
.
argv
[
1
]
name
=
sys
.
argv
[
1
]
output_bytes
=
subprocess
.
check_output
([
sys
.
executable
,
name
+
".py"
],
output_bytes
=
subprocess
.
check_output
([
sys
.
executable
,
name
+
".py"
],
stderr
=
subprocess
.
STDOUT
)
stderr
=
subprocess
.
STDOUT
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment