From 5b61185f26d166d72f989f84b969d9861f5a8c9a Mon Sep 17 00:00:00 2001 From: xlauko Date: Thu, 5 Sep 2024 15:05:57 +0200 Subject: [PATCH] test: Update ghidra test run cmmands. --- test/ghidra/argc.c | 11 ++++++----- test/ghidra/array.c | 7 ++++--- test/ghidra/concat.c | 7 ++++--- test/ghidra/fib.c | 7 ++++--- test/ghidra/fread.c | 8 +++++--- test/ghidra/fwrite.c | 7 ++++--- test/ghidra/insert.c | 7 ++++--- test/ghidra/list.c | 7 ++++--- test/ghidra/matrix.c | 6 ++++-- test/ghidra/prime.c | 7 ++++--- test/ghidra/queue.c | 7 +++++-- test/ghidra/reverse.c | 8 +++++--- test/ghidra/sort.c | 14 ++++++++------ test/ghidra/struct.c | 8 +++++--- test/ghidra/structb.c | 7 +++++-- test/ghidra/sub.c | 8 +++++--- test/ghidra/test.c | 8 +++++--- test/ghidra/union.c | 8 +++++--- 18 files changed, 86 insertions(+), 56 deletions(-) diff --git a/test/ghidra/argc.c b/test/ghidra/argc.c index fad3fdc..9560a73 100644 --- a/test/ghidra/argc.c +++ b/test/ghidra/argc.c @@ -1,10 +1,11 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t argc %t1 && %file-check -vv %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function argc --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?argc}}" + +int argc(int argc, char **argv) { return argc; } -int argc(int argc, char **argv) { - return argc; -} int main(int a, char **argv) { return argc(a, argv); diff --git a/test/ghidra/array.c b/test/ghidra/array.c index 721f772..4517bd5 100644 --- a/test/ghidra/array.c +++ b/test/ghidra/array.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t array %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function array --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?array}}" #include #include @@ -26,4 +28,3 @@ int main(int a, char **argv) { return array(a, argv); } - diff --git a/test/ghidra/concat.c b/test/ghidra/concat.c index 6e6afaf..aa1faa8 100644 --- a/test/ghidra/concat.c +++ b/test/ghidra/concat.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t string_concat %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function string_concat --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?string_concat}}" #include #include @@ -16,4 +18,3 @@ int main() { printf("%s\n", string_concat(dest, src)); return 0; } - diff --git a/test/ghidra/fib.c b/test/ghidra/fib.c index 391186d..94558b8 100644 --- a/test/ghidra/fib.c +++ b/test/ghidra/fib.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t fibonacci %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function fibonacci --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?fibonacci}}" #include @@ -14,4 +16,3 @@ int main() { printf("%d: %d\n", n, fibonacci(n)); return 0; } - diff --git a/test/ghidra/fread.c b/test/ghidra/fread.c index e4acfee..ec7426b 100644 --- a/test/ghidra/fread.c +++ b/test/ghidra/fread.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t fread_test %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function fread_test --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?fread_test}}" #include @@ -22,4 +24,4 @@ int fread_test(void) { int main(void) { return fread_test(); -} \ No newline at end of file +} diff --git a/test/ghidra/fwrite.c b/test/ghidra/fwrite.c index 73db3fc..1797137 100644 --- a/test/ghidra/fwrite.c +++ b/test/ghidra/fwrite.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t write_file %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function write_file --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?write_file}}" #include @@ -19,4 +21,3 @@ int main() { write_file(filename, content); return 0; } - diff --git a/test/ghidra/insert.c b/test/ghidra/insert.c index ac81243..0ac4a9a 100644 --- a/test/ghidra/insert.c +++ b/test/ghidra/insert.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t insert_substring %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function insert_substring --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?insert_substring}}" #include #include @@ -21,4 +23,3 @@ int main() { printf("After insertion: %s\n", str); return 0; } - diff --git a/test/ghidra/list.c b/test/ghidra/list.c index a1f5175..e31e51b 100644 --- a/test/ghidra/list.c +++ b/test/ghidra/list.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t print_list %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function print_list --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?print_list}}" #include #include @@ -41,4 +43,3 @@ int main(void) { return 0; } - diff --git a/test/ghidra/matrix.c b/test/ghidra/matrix.c index 51a408e..02ae431 100644 --- a/test/ghidra/matrix.c +++ b/test/ghidra/matrix.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t multiply_matrices %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function multiply_matrices --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?multiply_matrices}}" #include diff --git a/test/ghidra/prime.c b/test/ghidra/prime.c index ee28315..6f32eb2 100644 --- a/test/ghidra/prime.c +++ b/test/ghidra/prime.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t is_prime %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function is_prime --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?is_prime}}" #include #include @@ -18,4 +20,3 @@ int main() { printf("is prime: %d\n", is_prime(n)); return 0; } - diff --git a/test/ghidra/queue.c b/test/ghidra/queue.c index 0c2ad3e..4230815 100644 --- a/test/ghidra/queue.c +++ b/test/ghidra/queue.c @@ -1,6 +1,9 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t dequeue %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function dequeue --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?dequeue}}" + #include #include diff --git a/test/ghidra/reverse.c b/test/ghidra/reverse.c index 4c3b273..6033cd0 100644 --- a/test/ghidra/reverse.c +++ b/test/ghidra/reverse.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t reverse_string %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function reverse_string --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?reverse_string}}" #include #include @@ -19,4 +21,4 @@ int main(void) { reverse_string(str); printf("Reversed: %s\n", str); return 0; -} \ No newline at end of file +} diff --git a/test/ghidra/sort.c b/test/ghidra/sort.c index be7c6c4..b3373f6 100644 --- a/test/ghidra/sort.c +++ b/test/ghidra/sort.c @@ -1,16 +1,18 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t sort_test %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function sort_test --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?sort_test}}" #include - + int sort_test() { int array[100], n, c, d, swap; scanf("%d", &n); for (c = 0; c < n; c++) scanf("%d", &array[c]); - + for (c = 0 ; c < n - 1; c++) { for (d = 0 ; d < n - c - 1; d++) { if (array[d] > array[d+1]) { @@ -20,10 +22,10 @@ int sort_test() } } } - + for (c = 0; c < n; c++) printf("%d\n", array[c]); - + return 0; } diff --git a/test/ghidra/struct.c b/test/ghidra/struct.c index 46fd913..e19e394 100644 --- a/test/ghidra/struct.c +++ b/test/ghidra/struct.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t struct_test %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function struct_test --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?struct_test}}" struct data { @@ -20,4 +22,4 @@ int struct_test(int argc, char **argv) int main(int argc, char **argv) { return struct_test(argc, argv); -} \ No newline at end of file +} diff --git a/test/ghidra/structb.c b/test/ghidra/structb.c index 6a16b9a..31da470 100644 --- a/test/ghidra/structb.c +++ b/test/ghidra/structb.c @@ -1,6 +1,9 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t structb %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function structb --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?structb}}" + #include diff --git a/test/ghidra/sub.c b/test/ghidra/sub.c index fad7c72..47d2f6f 100644 --- a/test/ghidra/sub.c +++ b/test/ghidra/sub.c @@ -1,12 +1,14 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t sub %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function sub --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?sub}}" #include int sub() { - int x; + int x; x = 4; return x - 4; } diff --git a/test/ghidra/test.c b/test/ghidra/test.c index e174b31..7f82776 100644 --- a/test/ghidra/test.c +++ b/test/ghidra/test.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t test %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function test --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?test}}" #include @@ -11,4 +13,4 @@ int test() { int main(void) { return test(); -} \ No newline at end of file +} diff --git a/test/ghidra/union.c b/test/ghidra/union.c index 93bcdfc..aafbad4 100644 --- a/test/ghidra/union.c +++ b/test/ghidra/union.c @@ -1,6 +1,8 @@ // UNSUPPORTED: system-windows -// RUN: %cc %s -o %t && %decompile-headless %t union_test %t1 && %file-check %s --input-file %t1 -// CHECK: {{...}} +// RUN: %cc %s -o %t.o +// RUN: %decompile-headless --input %t.o --function union_test --output %t +// RUN: %file-check -vv %s --input-file %t +// CHECK: "name":"{{_?union_test}}" struct access { @@ -23,4 +25,4 @@ int union_test(int argc, char **argv) int main(int argc, char **argv) { return union_test(argc, argv); -} \ No newline at end of file +}