| 241 return 1; |
241 return 1; |
| 242 } |
242 } |
| 243 } |
243 } |
| 244 |
244 |
| 245 // delete previous testrepo directory |
245 // delete previous testrepo directory |
| 246 char *args1[] = { "rm", "-Rf", "testrepo", NULL }; |
246 char *args1[] = { "rm", "-Rf", "testrepo", "wsgidav.yaml", NULL }; |
| 247 Process p_rm = process_spawn("/bin/rm", args1); |
247 Process p_rm = process_spawn("/bin/rm", args1); |
| 248 cxmutstr err = process_err_read_string(&p_rm); |
248 cxmutstr err = process_err_read_string(&p_rm); |
| 249 if(process_close(&p_rm) != 0) { |
249 if(process_close(&p_rm) != 0) { |
| 250 cxmutstr s = cx_strtrim(err); |
250 cxmutstr s = cx_strtrim(err); |
| 251 fprintf(stderr, "rm failed: %.*s\n", (int)s.length, s.ptr); |
251 fprintf(stderr, "rm failed: %.*s\n", (int)s.length, s.ptr); |
| 262 fprintf(stderr, "cp failed: %.*s\n", (int)s.length, s.ptr); |
262 fprintf(stderr, "cp failed: %.*s\n", (int)s.length, s.ptr); |
| 263 return 1; |
263 return 1; |
| 264 } |
264 } |
| 265 free(err.ptr); |
265 free(err.ptr); |
| 266 |
266 |
| |
267 // copy the config file to the build directory |
| |
268 char *args3[] = { "cp", "../test/wsgidav/wsgidav.yaml", "wsgidav.yaml", NULL }; |
| |
269 Process p_cp2 = process_spawn("/bin/cp", args3); |
| |
270 err = process_err_read_string(&p_cp2); |
| |
271 if(process_close(&p_cp2) != 0) { |
| |
272 cxmutstr s = cx_strtrim(err); |
| |
273 fprintf(stderr, "cp failed: %.*s\n", (int)s.length, s.ptr); |
| |
274 return 1; |
| |
275 } |
| |
276 free(err.ptr); |
| |
277 |
| 267 // start wsgidav |
278 // start wsgidav |
| 268 char *args3[] = { "wsgidav", "-c", "../test/wsgidav/wsgidav.yaml", NULL }; |
279 char *args4[] = { "wsgidav", "-c", "wsgidav.yaml", NULL }; |
| 269 wsgidav_process = process_spawn(wsgidav_exec_path, args3); |
280 wsgidav_process = process_spawn(wsgidav_exec_path, args4); |
| 270 |
281 |
| 271 // TODO: parse log or try to connect to localhost |
282 // TODO: parse log or try to connect to localhost |
| 272 sleep(1); |
283 sleep(1); |
| 273 |
284 |
| 274 return 0; |
285 return 0; |