mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
f67f7aef77
So far the only tests we had were end to end tests to assess the functionality of simple programs and, in particular, certain helper functions. In the perspective of being able to test individual features, and in particular check that we have no regressions in our analyses, we isolated these end to end tests in the Runtime directory. We kept in the root test directory the mechanism to compile a binary for a certain architecture so that all the test types can use it.
27 lines
519 B
C
27 lines
519 B
C
/*
|
|
* This file is distributed under the MIT License. See LICENSE.md for details.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <sys/syscall.h>
|
|
|
|
int root(char *buffer, size_t size) {
|
|
int result;
|
|
|
|
#ifdef TARGET_mips
|
|
__asm__("li $v0,0xfb8\n\tsyscall\n\tmove %0, $v0" : "=r"(result) : : "%v0");
|
|
#else
|
|
result = syscall(SYS_getuid);
|
|
#endif
|
|
|
|
return result;
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
printf("%d\n", root(argv[1], strlen(argv[1])));
|
|
return EXIT_SUCCESS;
|
|
}
|