Files
faumaray bba5c8a39a initial commit
Signed-off-by: Aleksey Selihov <faumaray@gmail.com>
2026-05-22 02:40:32 +03:00

25 lines
834 B
C

// 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;
}