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 asprintf(&binPath, "%s/../src/tvlserver/vlserver", build);
39 asprintf(&logPath, "%s/VLLog", dirname);
40 asprintf(&dbPath, "%s/vldb", dirname);
41 execl(binPath, "vlserver",
42 "-logfile", logPath, "-database", dbPath, "-config", dirname, NULL);
43 fprintf(stderr, "Running %s failed\n", binPath);
52 afstest_StopServer(pid_t serverPid)
56 kill(serverPid, SIGTERM);
58 waitpid(serverPid, &status, 0);
60 if (WIFSIGNALED(status) && WTERMSIG(status) != SIGTERM) {
61 fprintf(stderr, "Server died exited on signal %d\n", WTERMSIG(status));
64 if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
65 fprintf(stderr, "Server exited with code %d\n", WEXITSTATUS(status));
72 afstest_StartTestRPCService(const char *configPath,
75 afs_int32 (*proc) (struct rx_call *))
77 struct afsconf_dir *dir;
78 struct rx_securityClass **classes;
81 struct rx_service *service;
83 dir = afsconf_Open(configPath);
85 fprintf(stderr, "Server: Unable to open config directory\n");
89 code = rx_Init(htons(port));
91 fprintf(stderr, "Server: Unable to initialise RX\n");
95 afsconf_BuildServerSecurityObjects(dir, &classes, &numClasses);
96 service = rx_NewService(0, serviceId, "test", classes, numClasses,
98 if (service == NULL) {
99 fprintf(stderr, "Server: Unable to start to test service\n");
105 return 0; /* Not reached, we donated ourselves to StartServer */