diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-01-14 16:15:09 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-01-14 16:15:09 (GMT) |
commit | 836927aa902696297febc95132e2c82147c08c03 (patch) | |
tree | 64bcbaa67c6f70acdb5f4cc9184f600fad46b826 /test/src | |
parent | f7ca1ebaa5a527f817892bc3794452df1a6c20c6 (diff) | |
download | uscxml-836927aa902696297febc95132e2c82147c08c03.zip uscxml-836927aa902696297febc95132e2c82147c08c03.tar.gz uscxml-836927aa902696297febc95132e2c82147c08c03.tar.bz2 |
Expect Invoker and Fedora build fixes
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/test-expect.cpp | 58 | ||||
-rw-r--r-- | test/src/test-url.cpp | 28 |
2 files changed, 75 insertions, 11 deletions
diff --git a/test/src/test-expect.cpp b/test/src/test-expect.cpp new file mode 100644 index 0000000..51c3bcb --- /dev/null +++ b/test/src/test-expect.cpp @@ -0,0 +1,58 @@ +#include <tcl.h> +#include <expect_tcl.h> +#include <expect.h> +#include <stdlib.h> + +int main(int argc, char** argv) { + int rc = 0; + + Tcl_Interp *interp = Tcl_CreateInterp(); + Tcl_FindExecutable(argv[0]); + + if (Tcl_Init(interp) == TCL_ERROR) { + fprintf(stderr,"Tcl_Init failed: %s\n",Tcl_GetStringResult (interp)); + (void) exit(1); + } + + if (Expect_Init(interp) == TCL_ERROR) { + fprintf(stderr,"Expect_Init failed: %s\n",Tcl_GetStringResult (interp)); + (void) exit(1); + } + + exp_loguser = 1; + exp_is_debugging = 1; + exp_timeout = 3; + + FILE *fp; + int ec; +// char* program = "/usr/bin/telnet localhost 80"; +// if (0 > (ec = exp_spawnl("sh","sh","-c",program,(char *)0))) +// exit(0); +// if (NULL == (fp = fdopen(ec,"r+"))) +// exit(0); +// setbuf(fp,(char *)0); + + if (0 > (ec = exp_spawnl("/usr/bin/telnet", "/usr/bin/telnet","localhost", "80", (char *)0))) + exit(0); + if (NULL == (fp = fdopen(ec,"r+"))) + exit(0); + setbuf(fp,(char *)0); + + switch (exp_fexpectl(fp, + exp_glob, "qConnected to", 1, + exp_glob, "qConnection failed", 2, + exp_end)) { + case 1: + printf("SUCCESS!"); + fprintf(fp, "%s\r", "GET /"); + + break; + case 2: + printf("FAIL!"); + break; + + default: + break; + } + exit(EXIT_SUCCESS); +}
\ No newline at end of file diff --git a/test/src/test-url.cpp b/test/src/test-url.cpp index e0f8343..9c4d941 100644 --- a/test/src/test-url.cpp +++ b/test/src/test-url.cpp @@ -82,17 +82,23 @@ int main(int argc, char** argv) { #endif
{
- URL url(argv[0]);
- assert(canResolve(argv[0]));
- assert(canResolve(url.asString()));
-
- URL baseUrl = URL::asBaseURL(url);
- URL exeUrl(exeName);
- exeUrl.toAbsolute(baseUrl);
- assert(canResolve(exeUrl.asString()));
- std::cout << exeUrl.asString() << std::endl;
- exeUrl.download(true);
- assert(exeUrl.getInContent().length() > 0);
+ try {
+
+ URL url(argv[0]);
+ assert(canResolve(argv[0]));
+ assert(canResolve(url.asString()));
+
+ URL baseUrl = URL::asBaseURL(url);
+ URL exeUrl(exeName);
+ exeUrl.toAbsolute(baseUrl);
+ assert(canResolve(exeUrl.asString()));
+ std::cout << exeUrl.asString() << std::endl;
+ exeUrl.download(true);
+ assert(exeUrl.getInContent().length() > 0);
+
+ } catch (Event e) {
+ std::cout << e << std::endl;
+ }
}
{
|