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:
2003-04-15 11:16: Subject: Starting new pike processes from the testsuite
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.
/ Niels Möller (ny flexiblare bröstkorg)
Ok, I think I almost understand the second example (but why does it use test_amny rather than test_equal?), but not the first one. What are the criteria for saying if the first test succeeded or failed?
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 11:42: Subject: Starting new pike processes from the testsuite
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)
test_do tests fail if they fail to compile or throw an error. I don't think the intention here is for the test to actually fail if there is a memleak, but just to get lots of output on stderr.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-04-15 12:20: Subject: Starting new pike processes from the testsuite
Ok, I think I almost understand the second example (but why does it use test_amny rather than test_equal?), but not the first one. What are the criteria for saying if the first test succeeded or failed?
/ Niels Möller (ny flexiblare bröstkorg)
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:
2003-04-15 13:08: Subject: Starting new pike processes from the testsuite
test_do tests fail if they fail to compile or throw an error. I don't think the intention here is for the test to actually fail if there is a memleak, but just to get lots of output on stderr.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
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:
2003-04-15 13:51: Subject: Starting new pike processes from the testsuite
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)
And make clean fails too. Adding a target
clean: true
to refdoc/Makefile helps.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 14:53: Subject: Starting new pike processes from the testsuite
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)
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:
2003-04-15 14:55: Subject: Starting new pike processes from the testsuite
And make clean fails too. Adding a target
clean: true
to refdoc/Makefile helps.
/ Niels Möller (ny flexiblare bröstkorg)
z is a C99 format character that is used from printing "size_t" typed values. PRINTSIZET should only get set to "z" if your C compiler handles it.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-04-15 15:03: Subject: Starting new pike processes from the testsuite
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)
Then it seems the configure test is broken. I'm currently using gcc-2.95.4.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 15:06: Subject: Starting new pike processes from the testsuite
z is a C99 format character that is used from printing "size_t" typed values. PRINTSIZET should only get set to "z" if your C compiler handles it.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
The configure test is correct; the problem is that gcc's argument checker doesn't know about it.
/ Henrik Grubbström (Lysator)
Previous text:
2003-04-15 15:10: Subject: Starting new pike processes from the testsuite
Then it seems the configure test is broken. I'm currently using gcc-2.95.4.
/ Niels Möller (ny flexiblare bröstkorg)
s/C compiler/libc/
/ Henrik Grubbström (Lysator)
Previous text:
2003-04-15 15:06: Subject: Starting new pike processes from the testsuite
z is a C99 format character that is used from printing "size_t" typed values. PRINTSIZET should only get set to "z" if your C compiler handles it.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
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:
2003-04-15 13:51: Subject: Starting new pike processes from the testsuite
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)
SRCDIR is an m4 marco, so it won't get expanded inside [[]].
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-04-15 15:48: Subject: Starting new pike processes from the testsuite
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)
Ah. Is the same true for RUNPIKE?
I think it would be preferable for the testsuite driver to define some functions pike_spawn, pipe_popen, that does the right thing.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 15:50: Subject: Starting new pike processes from the testsuite
SRCDIR is an m4 marco, so it won't get expanded inside [[]].
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
No, RUNPIKE is a constant set by test_pike.pike
/ Martin Nilsson (har bott i google)
Previous text:
2003-04-15 15:52: Subject: Starting new pike processes from the testsuite
Ah. Is the same true for RUNPIKE?
I think it would be preferable for the testsuite driver to define some functions pike_spawn, pipe_popen, that does the right thing.
/ Niels Möller (ny flexiblare bröstkorg)
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:
2003-04-15 15:50: Subject: Starting new pike processes from the testsuite
SRCDIR is an m4 marco, so it won't get expanded inside [[]].
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
What happens is port 25678 is already in use? (For instance, by another testsuite)
/ Fredrik (Naranek) Hubinette (Real Build Master)
Previous text:
2003-04-15 13:51: Subject: Starting new pike processes from the testsuite
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)
The test will fail, I guess.
If that's a problem, one could hack the server program to try random ports until bind succeeds, and then write the port number to stdout.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 23:46: Subject: Starting new pike processes from the testsuite
What happens is port 25678 is already in use? (For instance, by another testsuite)
/ Fredrik (Naranek) Hubinette (Real Build Master)
That would also solve the wait - when the server is ready, you get the port.
/ David Hedbor
Previous text:
2003-04-15 23:48: Subject: Starting new pike processes from the testsuite
The test will fail, I guess.
If that's a problem, one could hack the server program to try random ports until bind succeeds, and then write the port number to stdout.
/ Niels Möller (ny flexiblare bröstkorg)
Why not just do bind(0) and report which port was bound?
/ Fredrik (Naranek) Hubinette (Real Build Master)
Previous text:
2003-04-15 23:48: Subject: Starting new pike processes from the testsuite
The test will fail, I guess.
If that's a problem, one could hack the server program to try random ports until bind succeeds, and then write the port number to stdout.
/ Niels Möller (ny flexiblare bröstkorg)
The testsuite for the Unicode module might also prove enlighting.
/ Martin Nilsson (har bott i google)
Previous text:
2003-04-15 11:42: Subject: Starting new pike processes from the testsuite
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)
If there is HTTPs server code, it probably belongs - would be great - in the Protocols.HTTP.Server tree.
/ Mirar
Previous text:
2003-04-15 11:16: Subject: Starting new pike processes from the testsuite
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.
/ Niels Möller (ny flexiblare bröstkorg)
I don't know what the interface should be like. There already is SSL.sslport, which mimics Stdio.Port. The https.pike program is just a dummy server with a hardcoded port, certificate, and key, used for testing.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 17:34: Subject: Starting new pike processes from the testsuite
If there is HTTPs server code, it probably belongs - would be great - in the Protocols.HTTP.Server tree.
/ Mirar
How about a SSL.Port class for a Stdio.Port emulator?
/ Per Hedbor ()
Previous text:
2003-04-15 17:37: Subject: Starting new pike processes from the testsuite
I don't know what the interface should be like. There already is SSL.sslport, which mimics Stdio.Port. The https.pike program is just a dummy server with a hardcoded port, certificate, and key, used for testing.
/ Niels Möller (ny flexiblare bröstkorg)
Sure, redesigning the interface of the SSL code would be nice, but not something I'm going to do any time soon.
All I want for now is some tests to help exersize the reorganization of Crypto...
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 17:38: Subject: Starting new pike processes from the testsuite
How about a SSL.Port class for a Stdio.Port emulator?
/ Per Hedbor ()
I think the best way to go about is to extend the testsuite of the Crypto (and _Crypto) module to test all API:s.
/ Martin Nilsson (har bott i google)
Previous text:
2003-04-15 17:44: Subject: Starting new pike processes from the testsuite
Sure, redesigning the interface of the SSL code would be nice, but not something I'm going to do any time soon.
All I want for now is some tests to help exersize the reorganization of Crypto...
/ Niels Möller (ny flexiblare bröstkorg)
The problems is that when *changes* are made to the Crypto API, however trivial (for example renamed methods or classes), the SSL code must be changed too, I want some SSL testcases to help with that.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 17:49: Subject: Starting new pike processes from the testsuite
I think the best way to go about is to extend the testsuite of the Crypto (and _Crypto) module to test all API:s.
/ Martin Nilsson (har bott i google)
The testsuite already ensures that all modules compiles. That aside, I have myself done one or two lame attempts to make SSL tests, but it's not like the module is well documented or easy to understand.
/ Martin Nilsson (har bott i google)
Previous text:
2003-04-15 18:02: Subject: Starting new pike processes from the testsuite
The problems is that when *changes* are made to the Crypto API, however trivial (for example renamed methods or classes), the SSL code must be changed too, I want some SSL testcases to help with that.
/ Niels Möller (ny flexiblare bröstkorg)
I read the masters thesis about it a few months ago, and I think it explained quite clearly how the module works. But then I guess I'm a little biased ;-)
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 18:09: Subject: Starting new pike processes from the testsuite
The testsuite already ensures that all modules compiles. That aside, I have myself done one or two lame attempts to make SSL tests, but it's not like the module is well documented or easy to understand.
/ Martin Nilsson (har bott i google)
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:
2003-04-15 18:02: Subject: Starting new pike processes from the testsuite
The problems is that when *changes* are made to the Crypto API, however trivial (for example renamed methods or classes), the SSL code must be changed too, I want some SSL testcases to help with that.
/ Niels Möller (vässar rödpennan)
That sounds like it should be really easy to implement just inheriting/mimicking HTTP.Server.Port and just changing create and the Stdio.Port part.
The tricky parts is certificates and stuff and API for that, I guess.
/ Mirar
Previous text:
2003-04-15 17:37: Subject: Starting new pike processes from the testsuite
I don't know what the interface should be like. There already is SSL.sslport, which mimics Stdio.Port. The https.pike program is just a dummy server with a hardcoded port, certificate, and key, used for testing.
/ Niels Möller (ny flexiblare bröstkorg)
I don't remember the details, but you put all SSL stuff in an SSL.context object, which you have to pass to the sslport constructor or something like that.
/ Niels Möller (ny flexiblare bröstkorg)
Previous text:
2003-04-15 17:41: Subject: Starting new pike processes from the testsuite
That sounds like it should be really easy to implement just inheriting/mimicking HTTP.Server.Port and just changing create and the Stdio.Port part.
The tricky parts is certificates and stuff and API for that, I guess.
/ Mirar
pike-devel@lists.lysator.liu.se