commit
bba5c8a39a
109 files changed
+14085
No files matched your search
@@ -0,0 +1,24 @@
|
||||
// Exec-mode test: a complete program with main() and printf.
|
||||
// Compiled to a .vlc and run via voidloader; tests that:
|
||||
// - main() is exported and callable
|
||||
// - printf works via PLT → host libc
|
||||
// - argc/argv are forwarded correctly (argv[0] = .vlc path)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// argv[0] is the .vlc path; expect at least one extra arg.
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "FAIL: expected at least one argument\n");
|
||||
return 1;
|
||||
}
|
||||
// Check argv[1] is what we passed from the test.
|
||||
if (strcmp(argv[1], "hello_arg") != 0) {
|
||||
fprintf(stderr, "FAIL: argv[1] = '%s', expected 'hello_arg'\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
printf("PASS: exec mode — argc=%d argv[0]=%s argv[1]=%s\n",
|
||||
argc, argv[0], argv[1]);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user