Skip to content

Commit 358226e

Browse files
2 parents bbe0fd9 + 384afbb commit 358226e

File tree

8 files changed

+227
-610
lines changed

8 files changed

+227
-610
lines changed

.github/ciimage/Dockerfile.ubuntu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ RUN python3 -m pip install --no-cache-dir meson ninja
2828
# Set environment variables
2929
ENV CC=/usr/bin/gcc
3030
ENV CXX=/usr/bin/g++
31-
ENV LD_LIBRARY_PATH=/usr/local/lib
31+
ENV LD_LIBRARY_PATH=/usr/local/lib

LICENSE

Lines changed: 201 additions & 373 deletions
Large diffs are not rendered by default.

code/tests/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if get_option('with_test').enabled()
2-
run_command(['python3', 'tools' / 'generate-runner.py'], check: true)
2+
run_command(['python3', 'tools' / 'runner.py'], check: true)
33
cards = run_command(['python3', 'tools' / 'wildcard.py'], check: true)
44

55
test_cases = ['unit_runner.c', cards.stdout().strip().split('\n')]

code/tests/tools/generate-note.py

Lines changed: 0 additions & 129 deletions
This file was deleted.

code/tests/tools/generate-runner.py renamed to code/tests/tools/runner.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
11
import os
22
import re
3+
import sys
34

45

56
class TestRunnerGenerator:
67
def __init__(self):
78
# Set the directory to a subdirectory named 'cases' within the current working directory
89
self.directory = os.path.join(os.getcwd(), "cases")
10+
# Detect if running on Apple (macOS)
11+
self.is_apple = sys.platform == "darwin"
912

1013
def find_test_groups(self):
11-
test_groups = set()
14+
c_cpp_groups = set()
15+
objc_groups = set()
16+
objcpp_groups = set()
1217
pattern = r"FOSSIL_TEST_GROUP\((\w+)\)"
1318

1419
# Walk through files in the specified directory, 'cases'
1520
for root, _, files in os.walk(self.directory):
1621
for file in files:
17-
# Search for C and C++ files
18-
if (file.startswith("test_") and file.endswith(".c")) or file.endswith(".cpp"):
19-
with open(os.path.join(root, file), "r") as f:
22+
if file.startswith("test_"):
23+
file_path = os.path.join(root, file)
24+
with open(file_path, "r") as f:
2025
content = f.read()
2126
matches = re.findall(pattern, content)
22-
test_groups.update(matches)
27+
if file.endswith(".c") or file.endswith(".cpp"):
28+
c_cpp_groups.update(matches)
29+
elif self.is_apple and file.endswith(".m"):
30+
objc_groups.update(matches)
31+
elif self.is_apple and file.endswith(".mm"):
32+
objcpp_groups.update(matches)
2333

24-
return list(test_groups)
34+
return list(c_cpp_groups), list(objc_groups), list(objcpp_groups)
2535

2636
def generate_c_runner(self, test_groups):
2737
# Prepare header content for the test runner
@@ -71,7 +81,12 @@ def generate_c_runner(self, test_groups):
7181

7282
# Instantiate the generator, find test groups, and generate the test runner
7383
generator = TestRunnerGenerator()
74-
test_groups = generator.find_test_groups()
84+
c_cpp_groups, objc_groups, objcpp_groups = generator.find_test_groups()
7585

76-
# Generate the test runner for C and C++ tests
86+
# Only include Objective-C/Objective-C++ groups if on Apple
87+
test_groups = c_cpp_groups
88+
if generator.is_apple:
89+
test_groups += objc_groups + objcpp_groups
90+
91+
# Generate the test runner for C and C++ (and Objective-C/Objective-C++ on Apple) tests
7792
generator.generate_c_runner(test_groups)

code/tests/tools/scan-code.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

code/tests/tools/scan-todos.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('Fossil Media', 'c', 'cpp',
22
meson_version: '>=1.8.0',
3-
license: 'MPL-2.0',
3+
license: 'Apache-2.0',
44
version: '0.1.0',
55
default_options: [
66
'c_std=c11,c18',

0 commit comments

Comments
 (0)