What's the recommended way of starting separate processes (which are Pike programs) from the testsuite?
I want to make a test case for the SSL code, by starting a https process using the SSL.pmod/https.pike program (which I'm not sure it really belongs in the module tree) or some similar code, and then use the client code in the url/http modules to connect to it.
Excerpts from the main testsuite.in:
test_do([[ // This is a memleak test rm("testsuite_test.pike"); Stdio.write_file("testsuite_test.pike", "constant Q=10000000000000000;\n" "int main() {}\n"); Process.system(RUNPIKE +" testsuite_test.pike"); rm("testsuite_test.pike"); ]])
test_any([[object p=Process.create_process(Process.split_quoted_string(RUNPIKE)+({"-e","exit(2)"})); sleep(10); return p->wait()]],2)
/ Henrik Grubbström (Lysator)
Previous text:
Would something like this work?
test_do([[ object p = Process.spawn(RUNPIKE, "SRCDIR/https.pike"); sleep(5); /* Wait a little for the server to startup */ HTTP.Query q = HTTP.get_url("https://localhost:25678"); if (q->status != 200 || search("html", q->data()) < 0) error("Failed\n"); p->kill(); ]])
The sleep is ugly, perhaps one could hack https.pike to send some signal to its parent once it has bound the port.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
Unfortunately, now make verify fails on one earlier test:
array_sscanf("\1000\1001\2000","%[\1000-\1111]%s");
make[2]: *** [run_hilfe] Segmentation fault make[2]: Leaving directory `/home/nisse/hack/pike/build/linux-2.4.18nisse-i686' make[1]: *** [compile] Error 2 make[1]: Leaving directory `/home/nisse/hack/pike' make: *** [run_hilfe] Error 2
Does anybody else get that? I'll try a make clean and a recompile first.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
And another oddity: I get
/* set this to the modifier type string to print size_t, like "" or "l" */ #define PRINTSIZET "z"
/* set this to the modifier type string to print ptrdiff_t, like "" or "l" */ #define PRINTPTRDIFFT "t"
in machine.h, but then gcc complains
/home/nisse/hack/pike/src/gc.c:2978: warning: unknown conversion type character `z' in format /home/nisse/hack/pike/src/gc.c:2978: warning: unknown conversion type character `z' in format
What's z supposed to mean?
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
I'm a little confused about how SRCDIR works in the testsuite files, and also about which of the Process.*-functions I should use. I'm trying with
test_do([[ object p = Process.Process(RUNPIKE + " "SRCDIR/https.pike""); sleep(5); /* Wait a little for the server to startup */ [...]
but that fails with
Pike: Couldn't find script to execute ("/home/nisse/hack/pike/build/linux-2.4.18nisse-i686/SRCDIR/https.pike")
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
Now I've changed the code to
test_do([[ object p = Process.Process(RUNPIKE + " "]]SRCDIR[[/https.pike"");
but it still doesn't work. I think I'm done for today, I'll just dnl out the test and check it in, in case somebody else would like to try it.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
Regarding SSL testcases, the references here might be relevant: http://www.mail-archive.com/openssl-dev@openssl.org/msg16503.html
/ Andreas Lange (två hål mindre)
Previous text:
pike-devel@lists.lysator.liu.se