public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] add test for tst_checkpoint_signal_child timing out
@ 2013-11-14  9:05 Jan Stancek
  2013-11-14 14:32 ` chrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2013-11-14  9:05 UTC (permalink / raw)
  To: ltp-list

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 <jstancek@redhat.com>
---
 .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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] add test for tst_checkpoint_signal_child timing out
  2013-11-14  9:05 [LTP] [PATCH] add test for tst_checkpoint_signal_child timing out Jan Stancek
@ 2013-11-14 14:32 ` chrubis
  2013-11-14 14:34   ` chrubis
  0 siblings, 1 reply; 3+ messages in thread
From: chrubis @ 2013-11-14 14:32 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi!
> 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 <jstancek@redhat.com>
> ---
>  .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;

We don't even have the do the for here simply calling just the
checkpoint init and checkpoint signal would do. :)

If you agree I can commit the simplified version right away.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] add test for tst_checkpoint_signal_child timing out
  2013-11-14 14:32 ` chrubis
@ 2013-11-14 14:34   ` chrubis
  0 siblings, 0 replies; 3+ messages in thread
From: chrubis @ 2013-11-14 14:34 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi!
> We don't even have the do the for here simply calling just the
                                ^
				fork

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-14 14:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14  9:05 [LTP] [PATCH] add test for tst_checkpoint_signal_child timing out Jan Stancek
2013-11-14 14:32 ` chrubis
2013-11-14 14:34   ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox