Skip to content

Commit 0cbf655

Browse files
authored
[testing] Hotfix for macOS fortran signature changes (#178)
First failing in CI in #177, may become a future doxygen problem.
1 parent a74a44a commit 0cbf655

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

testing/hierarchies.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
from __future__ import unicode_literals
2626
import codecs
2727
import os
28+
import platform
29+
import re
2830
import textwrap
2931
from copy import deepcopy
3032

@@ -1062,7 +1064,28 @@ def err_message():
10621064
for test_grand_child in test_child.children:
10631065
exhale_grand_child = None
10641066
if test_grand_child.kind == "function":
1067+
# NOTE: First hit in macOS, possibly inbound with newer doxygen elsewhere.
1068+
# Matching child for [function] 'conversions::degrees_to_radians_s' with
1069+
# signature
1070+
# 'real(c_float) function conversions::degrees_to_radians_s(degrees_s)'
1071+
# not found! Considered signatures:
1072+
# real(c_double) function conversions::degrees_to_radians_d(real(c_double), intent(in))
1073+
# real(c_float) function conversions::degrees_to_radians_s(real(c_float), intent(in))
1074+
# real(c_double) function conversions::radians_to_degrees_d(real(c_double), intent(in))
1075+
# real(c_float) function conversions::radians_to_degrees_s(real(c_float), intent(in))
1076+
#
1077+
# ns::func(paramname) => ns::func(paramtype, param???)
1078+
# degrees_s real(c_float), intent(in)
1079+
#
1080+
# Coming from cpp_fortran_mixed conversions.f90, relates to docstring...
10651081
test_signature = test_grand_child.full_signature()
1082+
if platform.system() == "Darwin" and \
1083+
test_grand_child.def_in_file.name == "conversions.f90":
1084+
test_signature = re.sub(
1085+
rf"(.*) (function ({test_grand_child.name}))\((.*)\)$",
1086+
r"\1 \2(\1, intent(in))",
1087+
test_signature
1088+
)
10661089
considered_signatures = [] # for error reporting help in CI
10671090
for candidate in exhale_child.children:
10681091
if candidate.kind == "function":
@@ -1308,6 +1331,29 @@ def set_error_string(s):
13081331

13091332
# Validate the return type, name, and signatures.
13101333
test_functions = set(f.full_signature() for f in test_overloads[key])
1334+
# NOTE: see _compare_children notes on macOS and `degrees_s` above.
1335+
# AssertionError: Items in the first set but not the second:
1336+
# 'real(c_float) function conversions::degrees_to_radians_s(degrees_s)'
1337+
# Items in the second set but not the first:
1338+
# 'real(c_float) function conversions::degrees_to_radians_s(real(c_float), intent(in))'
1339+
# function degrees_to_radians_s(degrees_s) result(radians_s)
1340+
# function radians_to_degrees_s(radians_s) result(degrees_s)
1341+
# function degrees_to_radians_d(degrees_d) result(radians_d)
1342+
# function radians_to_degrees_d(radians_d) result(degrees_d)
1343+
if platform.system() == "Darwin" and any(re.match(
1344+
r"^real\(c_.*\) function conversions::.*_to_.*\(.*_[sd]\)$", f)
1345+
for f in test_functions):
1346+
fixed_test_functions = []
1347+
for signature in test_functions:
1348+
func_name = re.sub(
1349+
r"real\(c_.*\) function (.*)\(.*", r"\1", signature
1350+
)
1351+
fixed_test_functions.append(re.sub(
1352+
rf"(.*) (function ({func_name}))\((.*)\)$",
1353+
r"\1 \2(\1, intent(in))",
1354+
signature
1355+
))
1356+
test_functions = set(fixed_test_functions)
13111357
# TODO: fix template specials
13121358
if test_functions == {"template <> int blargh(int)"}:
13131359
test_functions = {"int blargh(int)"}

0 commit comments

Comments
 (0)