Skip to content

Commit 453a162

Browse files
committed
Merge branch 'topic/gnatcheck/migrate_gnatcheck_tests' into 'master'
Cleanup and add features to the GNATcheck testing driver See merge request eng/libadalang/langkit-query-language!554
2 parents f71128d + 1249119 commit 453a162

File tree

8 files changed

+181
-62
lines changed

8 files changed

+181
-62
lines changed

testsuite/drivers/base_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def add_missing_flags(self):
146146
# For each line where an annotation is missing, add it before any other comment
147147
for line, count in missing_flag_annotations.items():
148148
# Split the source line to get the code and the comment parts
149-
line_split = source_lines[line - 1].split("--")
149+
line_split = source_lines[line - 1].split("--", maxsplit=1)
150150
code, comment = line_split[0], line_split[1].strip() if len(line_split) == 2 else ""
151151

152152
# Remove the already existing FLAG annotation if there is one

testsuite/drivers/gnatcheck_driver.py

Lines changed: 169 additions & 54 deletions
Large diffs are not rendered by default.

testsuite/tests/gnatcheck/emit_lkql_rule_file/test.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
testsuite_driver: No output file generated by gnatcheck
22
gnatcheck: error: no existing file to process
33
>>>program returned status code 3
4-
testsuite_driver: Content of rules.lkql
4+
Running "cat rules.lkql"...
55
goto_statements: [{}, {instance_name: "my_instance", only_unconditional: true}],
66
headers: [{header: "header.txt"}],
77
identifier_casing: [{exclude: "exclude.txt"}],

testsuite/tests/gnatcheck/emit_lkql_rule_file/test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ rules:
1313
- +RRestrictions:No_Abort_Statements,No_Use_Of_Attribute=>Image,No_Use_Of_Entity=>Ada.Text_IO.Put_Line
1414
extra_args:
1515
- --emit-lkql-rule-file
16-
post_python: "cat('rules.lkql', sort=True, trim_start=1, trim_end=1)"
16+
post_python: cat("rules.lkql", sort=True, trim_start=1, trim_end=1)
17+
canonicalize_backslashes: False

testsuite/tests/gnatcheck/subdirs/test.out

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ main.adb:3:05: rule violation: goto statement
99
main.adb:6:05: error: "Put_Line" is undefined
1010
main.adb:6:05: error: possible missing "with Ada.Text_IO; use Ada.Text_IO"
1111
no internal error detected
12-
Content of custom_subdirs/gnatcheck : ['gnatcheck-log1.TMP', 'main.adb.stderr', 'main.adb.stdout', 'restriction_pragmas.adc']
12+
Running "ls custom_subdirs/gnatcheck"...
13+
gnatcheck-log1.TMP
14+
main.adb.stderr
15+
main.adb.stdout
16+
restriction_pragmas.adc

testsuite/tests/gnatcheck/subdirs/test.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ project: prj.gpr
55
rules:
66
- +RGOTO_Statements
77
- +RWarnings:a
8-
list_dirs:
9-
- custom_subdirs/gnatcheck
8+
post_python: ls("custom_subdirs/gnatcheck")

testsuite/tests/gnatcheck_errors/already_existing_lkql_rule_file/test.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ testsuite_driver: No output file generated by gnatcheck
22
gnatcheck: error: no existing file to process
33
gnatcheck: error: cannot emit the LKQL rule file, <working-dir>/rules.lkql already exists
44
>>>program returned status code 2
5-
testsuite_driver: Content of rules.lkql
5+
Running "cat rules.lkql"...
66
val rules = @{
77
redundant_null_statements
88
}

testsuite/tests/gnatcheck_errors/already_existing_lkql_rule_file/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ rules:
44
- +RGoto_Statements
55
extra_args:
66
- --emit-lkql-rule-file
7-
post_python: "cat('rules.lkql', sort=False)"
7+
post_python: cat("rules.lkql", sort=False)

0 commit comments

Comments
 (0)