This is simple test for patch which adds timeout to tst_checkpoint_signal_child().
The test is expected to end with: Failed to open fifo 'tst_checkpoint_fifo' at tst_checkpoint_child_exits2.c:56: errno=ETIMEDOUT(110): Connection timed out Signed-off-by: Jan Stancek <[email protected]> --- .gitignore | 1 + lib/tests/tst_checkpoint_child_exits2.c | 62 +++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 0 deletions(-) create mode 100644 lib/tests/tst_checkpoint_child_exits2.c diff --git a/.gitignore b/.gitignore index 140f5f4..dfee1ad 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ logfile.* /lib/tests/tst_tmpdir_test /lib/tests/tst_checkpoint_child /lib/tests/tst_checkpoint_child_exits +/lib/tests/tst_checkpoint_child_exits2 /lib/tests/tst_checkpoint_parent /lib/tests/tst_checkpoint_parent_exits /lib/tests/tst_process_state diff --git a/lib/tests/tst_checkpoint_child_exits2.c b/lib/tests/tst_checkpoint_child_exits2.c new file mode 100644 index 0000000..fb79145 --- /dev/null +++ b/lib/tests/tst_checkpoint_child_exits2.c @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2013 Linux Test Project + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <sys/wait.h> + +#include "test.h" + +char *TCID = "tst_checkpoint_child_exits2"; +int TST_TOTAL = 1; + +static void cleanup(void) +{ + tst_rmdir(); +} + +int main(void) +{ + int pid; + struct tst_checkpoint checkpoint; + + tst_tmpdir(); + + pid = fork(); + + switch (pid) { + case -1: + tst_brkm(TBROK | TERRNO, NULL, "Fork failed"); + break; + case 0: + fprintf(stderr, "Child: exiting prior checkpoint init\n"); + exit(0); + break; + default: + wait(NULL); + TST_CHECKPOINT_INIT(&checkpoint); + TST_CHECKPOINT_SIGNAL_CHILD(cleanup, &checkpoint); + fprintf(stderr, "Parent: checkpoint reached\n"); + break; + } + + return 0; +} -- 1.7.1 ------------------------------------------------------------------------------ DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
