feat(parse): implement # and ## operator handling in macro expansion
- Add support for # (stringify) and ## (concatenation) operators in macro replacement lists - Implement scc_pp_expand_string_unsafe() to process operator tokens during macro expansion - Add helper macros to identify blank, stringify, and concatenation tokens in replacement lists - Include missing headers (ctype.h, string.h) for character handling functions - Update object macro expansion to use new string expansion function instead of simple concatenation - Improve whitespace handling in macro replacement parsing to prevent interference with operator processing
This commit is contained in:
@@ -608,7 +608,7 @@ class GccCompiler(Compiler):
|
||||
flags = {
|
||||
BuildMode.TEST: [
|
||||
"-DTEST_MODE",
|
||||
"-O2",
|
||||
"-O0",
|
||||
"-g",
|
||||
"--coverage",
|
||||
"-fprofile-update=atomic",
|
||||
@@ -648,7 +648,7 @@ class ClangCompiler(Compiler):
|
||||
flags = {
|
||||
BuildMode.TEST: [
|
||||
"-DTEST_MODE",
|
||||
"-O2",
|
||||
"-O0",
|
||||
"-g",
|
||||
"--coverage",
|
||||
"-fprofile-update=atomic",
|
||||
@@ -863,7 +863,7 @@ class PackageBuilder:
|
||||
"""打印依赖树"""
|
||||
self.context.resolver.print_tree()
|
||||
|
||||
def tests(self, filter_str: str = ""):
|
||||
def tests(self, filter_str: str = "", timeout: int = 30):
|
||||
"""运行测试"""
|
||||
targets = [
|
||||
t for t in self.context.get_targets() if t.type == TargetType.TEST_EXEC
|
||||
@@ -890,7 +890,7 @@ class PackageBuilder:
|
||||
for target in targets:
|
||||
logger.info("运行测试: %s", target.name)
|
||||
try:
|
||||
result = subprocess.run(target.output, check=True, timeout=30)
|
||||
result = subprocess.run(target.output, check=True, timeout=timeout)
|
||||
if result.returncode == 0:
|
||||
print(f" ✓ 测试 {target.name} 通过")
|
||||
passed += 1
|
||||
@@ -1066,6 +1066,7 @@ def create_parser():
|
||||
# test 命令
|
||||
test_parser = subparsers.add_parser("test", help="运行测试")
|
||||
add_common_args(test_parser)
|
||||
test_parser.add_argument("--timeout", "-t", type=int, default=3, help="测试时间")
|
||||
test_parser.add_argument("--filter", default="", help="过滤测试")
|
||||
test_parser.set_defaults(mode=BuildMode.TEST)
|
||||
|
||||
@@ -1135,7 +1136,7 @@ def main():
|
||||
builder.run()
|
||||
elif args.command == "test":
|
||||
builder.build([TargetType.TEST_EXEC])
|
||||
builder.tests(getattr(args, "filter", ""))
|
||||
builder.tests(args.filter, args.timeout)
|
||||
elif args.command == "clean":
|
||||
if hasattr(args, "all") and args.all:
|
||||
# 清理所有模式
|
||||
|
||||
Reference in New Issue
Block a user