12 #include <afs/cellconfig.h>
16 /* Start up the VLserver, using the configuration in dirname, and putting our
21 afstest_StartVLServer(char *dirname, pid_t *serverPid)
29 } else if (pid == 0) {
30 char *binPath, *logPath, *dbPath, *build;
33 build = getenv("BUILD");
38 if (asprintf(&binPath, "%s/../src/tvlserver/vlserver", build) < 0 ||
39 asprintf(&logPath, "%s/VLLog", dirname) < 0 ||
40 asprintf(&dbPath, "%s/vldb", dirname) < 0) {
41 fprintf(stderr, "Out of memory building vlserver arguments\n");
44 execl(binPath, "vlserver",
45 "-logfile", logPath, "-database", dbPath, "-config", dirname, NULL);
46 fprintf(stderr, "Running %s failed\n", binPath);
55 afstest_StopServer(pid_t serverPid)
59 kill(serverPid, SIGTERM);
61 waitpid(serverPid, &status, 0);
63 if (WIFSIGNALED(status) && WTERMSIG(status) != SIGTERM) {
64 fprintf(stderr, "Server died exited on signal %d\n", WTERMSIG(status));
67 if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
68 fprintf(stderr, "Server exited with code %d\n", WEXITSTATUS(status));
75 afstest_StartTestRPCService(const char *configPath,
78 afs_int32 (*proc) (struct rx_call *))
80 struct afsconf_dir *dir;
81 struct rx_securityClass **classes;
84 struct rx_service *service;
86 dir = afsconf_Open(configPath);
88 fprintf(stderr, "Server: Unable to open config directory\n");
92 code = rx_Init(htons(port));
94 fprintf(stderr, "Server: Unable to initialise RX\n");
98 afsconf_BuildServerSecurityObjects(dir, &classes, &numClasses);
99 service = rx_NewService(0, serviceId, "test", classes, numClasses,
101 if (service == NULL) {
102 fprintf(stderr, "Server: Unable to start to test service\n");
108 return 0; /* Not reached, we donated ourselves to StartServer */