|
@@ -18,6 +18,7 @@
|
|
|
#include "configuration.h"
|
|
|
#include "container-executor.h"
|
|
|
|
|
|
+#include <inttypes.h>
|
|
|
#include <errno.h>
|
|
|
#include <fcntl.h>
|
|
|
#include <unistd.h>
|
|
@@ -73,17 +74,17 @@ void run(const char *cmd) {
|
|
|
} else {
|
|
|
int status = 0;
|
|
|
if (waitpid(child, &status, 0) <= 0) {
|
|
|
- printf("FAIL: failed waiting for child process %s pid %d - %s\n",
|
|
|
- cmd, child, strerror(errno));
|
|
|
+ printf("FAIL: failed waiting for child process %s pid %" PRId64 " - %s\n",
|
|
|
+ cmd, (int64_t)child, strerror(errno));
|
|
|
exit(1);
|
|
|
}
|
|
|
if (!WIFEXITED(status)) {
|
|
|
- printf("FAIL: process %s pid %d did not exit\n", cmd, child);
|
|
|
+ printf("FAIL: process %s pid %" PRId64 " did not exit\n", cmd, (int64_t)child);
|
|
|
exit(1);
|
|
|
}
|
|
|
if (WEXITSTATUS(status) != 0) {
|
|
|
- printf("FAIL: process %s pid %d exited with error status %d\n", cmd,
|
|
|
- child, WEXITSTATUS(status));
|
|
|
+ printf("FAIL: process %s pid %" PRId64 " exited with error status %d\n", cmd,
|
|
|
+ (int64_t)child, WEXITSTATUS(status));
|
|
|
exit(1);
|
|
|
}
|
|
|
}
|
|
@@ -144,10 +145,11 @@ void check_pid_file(const char* pid_file, pid_t mypid) {
|
|
|
}
|
|
|
|
|
|
char myPidBuf[33];
|
|
|
- snprintf(myPidBuf, 33, "%d", mypid);
|
|
|
+ snprintf(myPidBuf, 33, "%" PRId64, (int64_t)mypid);
|
|
|
if (strncmp(pidBuf, myPidBuf, strlen(myPidBuf)) != 0) {
|
|
|
printf("FAIL: failed to find matching pid in pid file\n");
|
|
|
- printf("FAIL: Expected pid %d : Got %.*s", mypid, (int)bytes, pidBuf);
|
|
|
+ printf("FAIL: Expected pid %" PRId64 " : Got %.*s", (int64_t)mypid,
|
|
|
+ (int)bytes, pidBuf);
|
|
|
exit(1);
|
|
|
}
|
|
|
}
|
|
@@ -441,16 +443,16 @@ void run_test_in_child(const char* test_name, void (*func)()) {
|
|
|
} else {
|
|
|
int status = 0;
|
|
|
if (waitpid(child, &status, 0) == -1) {
|
|
|
- printf("FAIL: waitpid %d failed - %s\n", child, strerror(errno));
|
|
|
+ printf("FAIL: waitpid %" PRId64 " failed - %s\n", (int64_t)child, strerror(errno));
|
|
|
exit(1);
|
|
|
}
|
|
|
if (!WIFEXITED(status)) {
|
|
|
- printf("FAIL: child %d didn't exit - %d\n", child, status);
|
|
|
+ printf("FAIL: child %" PRId64 " didn't exit - %d\n", (int64_t)child, status);
|
|
|
exit(1);
|
|
|
}
|
|
|
if (WEXITSTATUS(status) != 0) {
|
|
|
- printf("FAIL: child %d exited with bad status %d\n",
|
|
|
- child, WEXITSTATUS(status));
|
|
|
+ printf("FAIL: child %" PRId64 " exited with bad status %d\n",
|
|
|
+ (int64_t)child, WEXITSTATUS(status));
|
|
|
exit(1);
|
|
|
}
|
|
|
}
|
|
@@ -471,7 +473,7 @@ void test_signal_container() {
|
|
|
sleep(3600);
|
|
|
exit(0);
|
|
|
} else {
|
|
|
- printf("Child container launched as %d\n", child);
|
|
|
+ printf("Child container launched as %" PRId64 "\n", (int64_t)child);
|
|
|
if (signal_container_as_user(yarn_username, child, SIGQUIT) != 0) {
|
|
|
exit(1);
|
|
|
}
|
|
@@ -508,7 +510,7 @@ void test_signal_container_group() {
|
|
|
sleep(3600);
|
|
|
exit(0);
|
|
|
}
|
|
|
- printf("Child container launched as %d\n", child);
|
|
|
+ printf("Child container launched as %" PRId64 "\n", (int64_t)child);
|
|
|
// there's a race condition for child calling change_user and us
|
|
|
// calling signal_container_as_user, hence sleeping
|
|
|
sleep(3);
|
|
@@ -586,7 +588,7 @@ void test_init_app() {
|
|
|
}
|
|
|
int status = 0;
|
|
|
if (waitpid(child, &status, 0) <= 0) {
|
|
|
- printf("FAIL: failed waiting for process %d - %s\n", child,
|
|
|
+ printf("FAIL: failed waiting for process %" PRId64 " - %s\n", (int64_t)child,
|
|
|
strerror(errno));
|
|
|
exit(1);
|
|
|
}
|
|
@@ -687,7 +689,7 @@ void test_run_container() {
|
|
|
}
|
|
|
int status = 0;
|
|
|
if (waitpid(child, &status, 0) <= 0) {
|
|
|
- printf("FAIL: failed waiting for process %d - %s\n", child,
|
|
|
+ printf("FAIL: failed waiting for process %" PRId64 " - %s\n", (int64_t)child,
|
|
|
strerror(errno));
|
|
|
exit(1);
|
|
|
}
|