Skip to content

Commit

Permalink
test: Update ghidra test run cmmands.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Sep 5, 2024
1 parent 67e1874 commit 5b61185
Show file tree
Hide file tree
Showing 18 changed files with 86 additions and 56 deletions.
11 changes: 6 additions & 5 deletions test/ghidra/argc.c
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
7 changes: 4 additions & 3 deletions test/ghidra/array.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <stdlib.h>
Expand All @@ -26,4 +28,3 @@ int main(int a, char **argv)
{
return array(a, argv);
}

7 changes: 4 additions & 3 deletions test/ghidra/concat.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <string.h>
Expand All @@ -16,4 +18,3 @@ int main() {
printf("%s\n", string_concat(dest, src));
return 0;
}

7 changes: 4 additions & 3 deletions test/ghidra/fib.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

Expand All @@ -14,4 +16,3 @@ int main() {
printf("%d: %d\n", n, fibonacci(n));
return 0;
}

8 changes: 5 additions & 3 deletions test/ghidra/fread.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

Expand All @@ -22,4 +24,4 @@ int fread_test(void) {

int main(void) {
return fread_test();
}
}
7 changes: 4 additions & 3 deletions test/ghidra/fwrite.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

Expand All @@ -19,4 +21,3 @@ int main() {
write_file(filename, content);
return 0;
}

7 changes: 4 additions & 3 deletions test/ghidra/insert.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <string.h>
Expand All @@ -21,4 +23,3 @@ int main() {
printf("After insertion: %s\n", str);
return 0;
}

7 changes: 4 additions & 3 deletions test/ghidra/list.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -41,4 +43,3 @@ int main(void) {

return 0;
}

6 changes: 4 additions & 2 deletions test/ghidra/matrix.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

Expand Down
7 changes: 4 additions & 3 deletions test/ghidra/prime.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <stdbool.h>
Expand All @@ -18,4 +20,3 @@ int main() {
printf("is prime: %d\n", is_prime(n));
return 0;
}

7 changes: 5 additions & 2 deletions test/ghidra/queue.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <stdlib.h>
Expand Down
8 changes: 5 additions & 3 deletions test/ghidra/reverse.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <string.h>
Expand All @@ -19,4 +21,4 @@ int main(void) {
reverse_string(str);
printf("Reversed: %s\n", str);
return 0;
}
}
14 changes: 8 additions & 6 deletions test/ghidra/sort.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

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]) {
Expand All @@ -20,10 +22,10 @@ int sort_test()
}
}
}

for (c = 0; c < n; c++)
printf("%d\n", array[c]);

return 0;
}

Expand Down
8 changes: 5 additions & 3 deletions test/ghidra/struct.c
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -20,4 +22,4 @@ int struct_test(int argc, char **argv)
int main(int argc, char **argv) {
return struct_test(argc, argv);

}
}
7 changes: 5 additions & 2 deletions test/ghidra/structb.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

Expand Down
8 changes: 5 additions & 3 deletions test/ghidra/sub.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

int sub()
{
int x;
int x;
x = 4;
return x - 4;
}
Expand Down
8 changes: 5 additions & 3 deletions test/ghidra/test.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

Expand All @@ -11,4 +13,4 @@ int test() {

int main(void) {
return test();
}
}
8 changes: 5 additions & 3 deletions test/ghidra/union.c
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -23,4 +25,4 @@ int union_test(int argc, char **argv)

int main(int argc, char **argv) {
return union_test(argc, argv);
}
}

0 comments on commit 5b61185

Please sign in to comment.