Rust: improve QL test script

This commit is contained in:
Arthur Baars
2024-10-06 13:13:55 +02:00
parent 3e877ffaac
commit 1135bf6bcd
13 changed files with 33 additions and 27 deletions

View File

@@ -1,4 +1,3 @@
| gen_module.rs:3:1:4:8 | Module | getNumberOfAttrs: | 0 | hasItemList: | no | hasName: | yes | hasVisibility: | no |
| gen_module.rs:5:1:7:1 | Module | getNumberOfAttrs: | 0 | hasItemList: | yes | hasName: | yes | hasVisibility: | no |
| lib.rs:2:1:2:15 | Module | getNumberOfAttrs: | 0 | hasItemList: | no | hasName: | yes | hasVisibility: | no |
| lib.rs:3:1:3:8 | Module | getNumberOfAttrs: | 0 | hasItemList: | no | hasName: | yes | hasVisibility: | no |

View File

@@ -1,4 +1,3 @@
| gen_module.rs:3:1:4:8 | Module | gen_module.rs:4:5:4:7 | Name |
| gen_module.rs:5:1:7:1 | Module | gen_module.rs:5:5:5:7 | Name |
| lib.rs:2:1:2:15 | Module | lib.rs:2:5:2:14 | Name |
| lib.rs:3:1:3:8 | Module | lib.rs:3:5:3:7 | Name |

View File

@@ -1,3 +1,2 @@
| gen_name.rs:3:4:3:12 | Name | hasText: | yes |
| lib.rs:2:5:2:12 | Name | hasText: | yes |
| lib.rs:3:5:3:7 | Name | hasText: | yes |

View File

@@ -1,3 +1,2 @@
| gen_name.rs:3:4:3:12 | Name | test_name |
| lib.rs:2:5:2:12 | Name | gen_name |
| lib.rs:3:5:3:7 | Name | lib |

View File

@@ -1,2 +1,2 @@
| gen_source_file.rs:1:1:6:2 | SourceFile | getNumberOfAttrs: | 0 | getNumberOfItems: | 1 |
| lib.rs:1:1:3:9 | SourceFile | getNumberOfAttrs: | 0 | getNumberOfItems: | 2 |
| lib.rs:1:1:2:21 | SourceFile | getNumberOfAttrs: | 0 | getNumberOfItems: | 1 |

View File

@@ -1,3 +1,2 @@
| gen_source_file.rs:1:1:6:2 | SourceFile | 0 | gen_source_file.rs:3:1:6:1 | test_source_file |
| lib.rs:1:1:3:9 | SourceFile | 0 | lib.rs:2:1:2:20 | Module |
| lib.rs:1:1:3:9 | SourceFile | 1 | lib.rs:3:1:3:8 | Module |
| lib.rs:1:1:2:21 | SourceFile | 0 | lib.rs:2:1:2:20 | Module |

View File

@@ -1,5 +1,5 @@
| lib.rs:3:9:3:8 | expected `;` or `{` |
| lib.rs:3:9:3:8 | expected an item |
| lib.rs:3:10:3:21 | macro expansion failed: could not resolve macro 'identifiers' |
| lib.rs:3:21:3:20 | expected BANG |
| lib.rs:3:21:3:20 | expected `{`, `[`, `(` |
| lib.rs:2:9:2:8 | expected `;` or `{` |
| lib.rs:2:9:2:8 | expected an item |
| lib.rs:2:10:2:21 | macro expansion failed: could not resolve macro 'identifiers' |
| lib.rs:2:21:2:20 | expected BANG |
| lib.rs:2:21:2:20 | expected `{`, `[`, `(` |

View File

@@ -1,12 +1,10 @@
| lib.rs:1:1:3:22 | SourceFile |
| lib.rs:1:1:2:22 | SourceFile |
| lib.rs:2:1:2:8 | Module |
| lib.rs:2:5:2:7 | Name |
| lib.rs:3:1:3:8 | Module |
| lib.rs:3:5:3:8 | Name |
| lib.rs:3:10:3:20 | NameRef |
| lib.rs:3:10:3:20 | Path |
| lib.rs:3:10:3:20 | PathSegment |
| lib.rs:3:10:3:21 | MacroCall |
| lib.rs:2:5:2:8 | Name |
| lib.rs:2:10:2:20 | NameRef |
| lib.rs:2:10:2:20 | Path |
| lib.rs:2:10:2:20 | PathSegment |
| lib.rs:2:10:2:21 | MacroCall |
| utf8-identifiers.rs:1:1:4:6 | foo |
| utf8-identifiers.rs:1:1:12:2 | SourceFile |
| utf8-identifiers.rs:1:4:1:6 | Name |

View File

@@ -1 +1 @@
| 61 |
| 59 |

View File

@@ -1 +1 @@
| 61 |
| 59 |

View File

@@ -1,7 +1,7 @@
| my_struct.rs:0:0:0:0 | my_struct.rs | 20 |
| comments.rs:0:0:0:0 | comments.rs | 13 |
| main.rs:0:0:0:0 | main.rs | 8 |
| lib.rs:0:0:0:0 | lib.rs | 7 |
| my_macro.rs:0:0:0:0 | my_macro.rs | 7 |
| lib.rs:0:0:0:0 | lib.rs | 5 |
| does_not_compile.rs:0:0:0:0 | does_not_compile.rs | 3 |
| error.rs:0:0:0:0 | error.rs | 3 |

View File

@@ -1,5 +1,5 @@
| Elements extracted | 380 |
| Elements extracted | 376 |
| Elements unextracted | 0 |
| Files extracted | 7 |
| Lines of code extracted | 61 |
| Lines of user code extracted | 61 |
| Lines of code extracted | 59 |
| Lines of user code extracted | 59 |

View File

@@ -9,7 +9,13 @@ QLTEST_LOG="$CODEQL_EXTRACTOR_RUST_LOG_DIR"/qltest.log
EXTRACTOR="$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor"
echo > lib.rs
for src in *.rs; do
if [[ "$src" == "lib.rs" ]]; then
continue
elif [[ "$src" == "main.rs" ]]; then
continue
else
echo "mod ${src%.rs};" >> lib.rs
fi
done
cat > Cargo.toml << EOF
[workspace]
@@ -20,6 +26,13 @@ edition="2021"
[lib]
path="lib.rs"
EOF
if [[ -f "main.rs" ]]; then
cat >> Cargo.toml << EOF
[[bin]]
name = "main"
path = "main.rs"
EOF
fi
"$EXTRACTOR" *.rs >> "$QLTEST_LOG"
if [[ "$?" != 0 ]]; then
cat "$QLTEST_LOG" # Show compiler errors on extraction failure