Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added configuration for c/cpp tests #8440

Merged
merged 3 commits into from
Feb 25, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions unit-tests/run-unit-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,33 @@ def __init__( self, testname, exe ):
:param testname: name of the test
:param exe: full path to executable
"""
global current_dir
Test.__init__(self, testname)
self.exe = exe

# Finding the c/cpp file of the test to get the configuration
MMirbach marked this conversation as resolved.
Show resolved Hide resolved
split_testname = testname.split( '-' )
cpp_path = current_dir
found_test_dir = False

while not found_test_dir:
MMirbach marked this conversation as resolved.
Show resolved Hide resolved
found_test_dir = True
for i in range(2, len(split_testname) ): # Checking if the next part of the test name is a sub-directory
tmp_path = cpp_path + os.sep + '-'.join(split_testname[1:i]) # The next sub-directory could have several words
if os.path.isdir(tmp_path):
cpp_path = tmp_path
del split_testname[1:i]
found_test_dir = False
break

cpp_path += os.sep + '-'.join( split_testname )
if os.path.isfile( cpp_path + ".cpp" ):
MMirbach marked this conversation as resolved.
Show resolved Hide resolved
cpp_path += ".cpp"
else:
cpp_path += ".c"

self._config = TestConfigFromText( cpp_path, r'//\s*#\s*test:' )
MMirbach marked this conversation as resolved.
Show resolved Hide resolved

@property
def command(self):
return [self.exe]
Expand Down