mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: improve QL test script
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
| gen_module.rs:3:1:4:8 | Module | getNumberOfAttrs: | 0 | hasItemList: | no | hasName: | yes | hasVisibility: | no |
|
| 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 |
|
| 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: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 |
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
| gen_module.rs:3:1:4:8 | Module | gen_module.rs:4:5:4:7 | Name |
|
| 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 |
|
| 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: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 |
|
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
| gen_name.rs:3:4:3:12 | Name | hasText: | yes |
|
| gen_name.rs:3:4:3:12 | Name | hasText: | yes |
|
||||||
| lib.rs:2:5:2:12 | Name | hasText: | yes |
|
| lib.rs:2:5:2:12 | Name | hasText: | yes |
|
||||||
| lib.rs:3:5:3:7 | Name | hasText: | yes |
|
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
| gen_name.rs:3:4:3:12 | Name | test_name |
|
| gen_name.rs:3:4:3:12 | Name | test_name |
|
||||||
| lib.rs:2:5:2:12 | Name | gen_name |
|
| lib.rs:2:5:2:12 | Name | gen_name |
|
||||||
| lib.rs:3:5:3:7 | Name | lib |
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
| gen_source_file.rs:1:1:6:2 | SourceFile | getNumberOfAttrs: | 0 | getNumberOfItems: | 1 |
|
| 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 |
|
||||||
|
|||||||
@@ -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 |
|
| 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:2:21 | SourceFile | 0 | lib.rs:2:1:2:20 | Module |
|
||||||
| lib.rs:1:1:3:9 | SourceFile | 1 | lib.rs:3:1:3:8 | Module |
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
| lib.rs:3:9:3:8 | expected `;` or `{` |
|
| lib.rs:2:9:2:8 | expected `;` or `{` |
|
||||||
| lib.rs:3:9:3:8 | expected an item |
|
| lib.rs:2:9:2:8 | expected an item |
|
||||||
| lib.rs:3:10:3:21 | macro expansion failed: could not resolve macro 'identifiers' |
|
| lib.rs:2:10:2:21 | macro expansion failed: could not resolve macro 'identifiers' |
|
||||||
| lib.rs:3:21:3:20 | expected BANG |
|
| lib.rs:2:21:2:20 | expected BANG |
|
||||||
| lib.rs:3:21:3:20 | expected `{`, `[`, `(` |
|
| lib.rs:2:21:2:20 | expected `{`, `[`, `(` |
|
||||||
|
|||||||
@@ -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:1:2:8 | Module |
|
||||||
| lib.rs:2:5:2:7 | Name |
|
| lib.rs:2:5:2:8 | Name |
|
||||||
| lib.rs:3:1:3:8 | Module |
|
| lib.rs:2:10:2:20 | NameRef |
|
||||||
| lib.rs:3:5:3:8 | Name |
|
| lib.rs:2:10:2:20 | Path |
|
||||||
| lib.rs:3:10:3:20 | NameRef |
|
| lib.rs:2:10:2:20 | PathSegment |
|
||||||
| lib.rs:3:10:3:20 | Path |
|
| lib.rs:2:10:2:21 | MacroCall |
|
||||||
| lib.rs:3:10:3:20 | PathSegment |
|
|
||||||
| lib.rs:3:10:3:21 | MacroCall |
|
|
||||||
| utf8-identifiers.rs:1:1:4:6 | foo |
|
| utf8-identifiers.rs:1:1:4:6 | foo |
|
||||||
| utf8-identifiers.rs:1:1:12:2 | SourceFile |
|
| utf8-identifiers.rs:1:1:12:2 | SourceFile |
|
||||||
| utf8-identifiers.rs:1:4:1:6 | Name |
|
| utf8-identifiers.rs:1:4:1:6 | Name |
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
| 61 |
|
| 59 |
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
| 61 |
|
| 59 |
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
| my_struct.rs:0:0:0:0 | my_struct.rs | 20 |
|
| my_struct.rs:0:0:0:0 | my_struct.rs | 20 |
|
||||||
| comments.rs:0:0:0:0 | comments.rs | 13 |
|
| comments.rs:0:0:0:0 | comments.rs | 13 |
|
||||||
| main.rs:0:0:0:0 | main.rs | 8 |
|
| 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 |
|
| 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 |
|
| does_not_compile.rs:0:0:0:0 | does_not_compile.rs | 3 |
|
||||||
| error.rs:0:0:0:0 | error.rs | 3 |
|
| error.rs:0:0:0:0 | error.rs | 3 |
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
| Elements extracted | 380 |
|
| Elements extracted | 376 |
|
||||||
| Elements unextracted | 0 |
|
| Elements unextracted | 0 |
|
||||||
| Files extracted | 7 |
|
| Files extracted | 7 |
|
||||||
| Lines of code extracted | 61 |
|
| Lines of code extracted | 59 |
|
||||||
| Lines of user code extracted | 61 |
|
| Lines of user code extracted | 59 |
|
||||||
|
|||||||
@@ -9,7 +9,13 @@ QLTEST_LOG="$CODEQL_EXTRACTOR_RUST_LOG_DIR"/qltest.log
|
|||||||
EXTRACTOR="$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor"
|
EXTRACTOR="$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor"
|
||||||
echo > lib.rs
|
echo > lib.rs
|
||||||
for src in *.rs; do
|
for src in *.rs; do
|
||||||
echo "mod ${src%.rs};" >> lib.rs
|
if [[ "$src" == "lib.rs" ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$src" == "main.rs" ]]; then
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
echo "mod ${src%.rs};" >> lib.rs
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
cat > Cargo.toml << EOF
|
cat > Cargo.toml << EOF
|
||||||
[workspace]
|
[workspace]
|
||||||
@@ -20,6 +26,13 @@ edition="2021"
|
|||||||
[lib]
|
[lib]
|
||||||
path="lib.rs"
|
path="lib.rs"
|
||||||
EOF
|
EOF
|
||||||
|
if [[ -f "main.rs" ]]; then
|
||||||
|
cat >> Cargo.toml << EOF
|
||||||
|
[[bin]]
|
||||||
|
name = "main"
|
||||||
|
path = "main.rs"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
"$EXTRACTOR" *.rs >> "$QLTEST_LOG"
|
"$EXTRACTOR" *.rs >> "$QLTEST_LOG"
|
||||||
if [[ "$?" != 0 ]]; then
|
if [[ "$?" != 0 ]]; then
|
||||||
cat "$QLTEST_LOG" # Show compiler errors on extraction failure
|
cat "$QLTEST_LOG" # Show compiler errors on extraction failure
|
||||||
|
|||||||
Reference in New Issue
Block a user