Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
some new files used to check Tesh
[simgrid.git] / tools / tesh2 / examples / keep-going-unit.tesh
diff --git a/tools/tesh2/examples/keep-going-unit.tesh b/tools/tesh2/examples/keep-going-unit.tesh
new file mode 100644 (file)
index 0000000..22ce9dc
--- /dev/null
@@ -0,0 +1,90 @@
+#! ./tesh\r
+\r
+D this Tesh unit tests the option of the command line `--keep-going'\r
+\r
+< #include <stdlib.h>\r
+< #include <stdio.h>\r
+< \r
+< int\r
+< main(int argc, char* argv[])\r
+< {\r
+<      printf("Hello Tesh\n");\r
+<      \r
+<      return EXIT_SUCCESS;\r
+< }\r
+< \r
+$ cat > job.c\r
+\r
+$ gcc -o job job.c\r
+\r
+# in this case the option keep-going-unit is not specified so only the first command is executed.\r
+! expect return $EEXITCODENOTMATCH\r
+\r
+< ! expect return 1\r
+< > Hello Tesh\r
+< $ ./job\r
+< \r
+< ! expect return 0\r
+< > Hello Tesh\r
+< $ ./job\r
+< \r
+< ! expect return 0\r
+< > Hello Tesh\r
+< $ ./job\r
+< \r
+< ! expect return 0\r
+< > Hello Tesh\r
+< $ ./job\r
+< \r
+< ! expect return 0\r
+< > Hello Tesh\r
+< $ ./job\r
+$ ./tesh --log='log.thresh:info tesh.fmt:%m%n'\r
+> Test unit from stdin\r
+> [stdin:3] ./job\r
+> [stdin:3] ./job : NOK (returned code `0' instead `1')\r
+> Output of <stdin:3> so far: \r
+> ||Hello Tesh\r
+> ||\r
+> Test unit `(stdin)' : NOK (exit code mismatch)\r
+\r
+\r
+# in this case the option keep-going-unit is specified so, all the command are executed.\r
+! expect return $EEXITCODENOTMATCH\r
+\r
+< ! expect return 1\r
+< > Hello Tesh\r
+< $ ./job\r
+< \r
+< ! expect return 0\r
+< > Hello Tesh\r
+< $ ./job\r
+< \r
+< ! expect return 0\r
+< > Hello Tesh\r
+< $ ./job\r
+< \r
+< ! expect return 0\r
+< > Hello Tesh\r
+< $ ./job\r
+< \r
+< ! expect return 0\r
+< > Hello Tesh\r
+< $ ./job\r
+$ ./tesh --log='log.thresh:info tesh.fmt:%m%n'  --keep-going-unit\r
+> Test unit from stdin\r
+> [stdin:3] ./job\r
+> [stdin:3] ./job : NOK (returned code `0' instead `1')\r
+> Output of <stdin:3> so far: \r
+> ||Hello Tesh\r
+> ||\r
+> [stdin:7] ./job\r
+> [stdin:11] ./job\r
+> [stdin:15] ./job\r
+> [stdin:19] ./job\r
+> Test unit `(stdin)' : NOK (exit code mismatch)\r
+\r
+\r
+$ rm -f job\r
+\r
+$ rm -f job.c
\ No newline at end of file