Steve Langasek has proposed merging lp:~vorlon/upstart/check-for-overlayfs into 
lp:upstart.

Requested reviews:
  James Hunt (jamesodhunt)

For more details, see:
https://code.launchpad.net/~vorlon/upstart/check-for-overlayfs/+merge/193726


-- 
https://code.launchpad.net/~vorlon/upstart/check-for-overlayfs/+merge/193726
Your team Upstart Reviewers is subscribed to branch lp:upstart.
=== modified file 'ChangeLog'
--- ChangeLog	2013-11-03 02:56:57 +0000
+++ ChangeLog	2013-11-04 01:15:45 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
 2013-10-25  Steve Langasek  <[email protected]>
 
 	* init/main.c, init/system.c, init/system.h: allow mount options
@@ -88,6 +89,21 @@
 	  running in user mode (for 'check-config').
 
 2013-10-04  Steve Langasek  <[email protected]>
+=======
+2013-10-17  James Hunt  <[email protected]>
+
+	* test/tests/test_util_check_env.c:
+	  - check_for_overlayfs(): Only consider temporary work area.
+
+2013-10-16  James Hunt  <[email protected]>
+
+	* test/tests/test_util_check_env.c: New test to look for
+	  overlayfs filesystems which could cause tests to fail.
+	* test/Makefile.am: Added test_util_check_env meta-test.
+	* test/test_util_common.c: Formatting.
+
+2013-10-04  Steve Langasek  <[email protected]
+>>>>>>> MERGE-SOURCE
 
 	* extra/upstart-local-bridge.c: use SOCKET_PATH in our event
 	  environment, instead of clobbering PATH.  (LP: #1235480)

=== modified file 'test/Makefile.am'
--- test/Makefile.am	2013-06-25 09:19:05 +0000
+++ test/Makefile.am	2013-11-04 01:15:45 +0000
@@ -18,4 +18,17 @@
 	-I$(top_srcdir)/intl
 
 check_LIBRARIES = libtest_util_common.a
-libtest_util_common_a_SOURCES = test_util_common.c test_util_common.h
+libtest_util_common_a_SOURCES = \
+	test_util_common.c \
+	test_util_common.h
+
+TESTS = test_util_check_env
+check_PROGRAMS = $(TESTS)
+
+.PHONY: tests
+tests: $(check_PROGRAMS)
+
+test_util_check_env_SOURCES = tests/test_util_check_env.c
+test_util_check_env_LDADD = \
+	libtest_util_common.a \
+	$(NIH_LIBS)

=== modified file 'test/test_util_common.c'
--- test/test_util_common.c	2013-11-03 02:54:03 +0000
+++ test/test_util_common.c	2013-11-04 01:15:45 +0000
@@ -162,7 +162,7 @@
 	 * within a reasonable period of time.
 	 */
 	for (i = 0; i < loops; i++) {
-        sleep (1);
+		sleep (1);
 
 		RUN_COMMAND (NULL, cmd, &output, &lines);
 

=== added directory 'test/tests'
=== added file 'test/tests/test_util_check_env.c'
--- test/tests/test_util_check_env.c	1970-01-01 00:00:00 +0000
+++ test/tests/test_util_check_env.c	2013-11-04 01:15:45 +0000
@@ -0,0 +1,102 @@
+/* upstart
+ *
+ * test_util_check_env.c - meta test to ensure environment sane for
+ * running tests.
+ *
+ * Copyright © 2013 Canonical Ltd.
+ * Author: James Hunt <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <limits.h>
+#include <unistd.h>
+#include <mntent.h>
+
+#include <nih/string.h>
+#include <nih/test.h>
+#include <nih/logging.h>
+
+#include "test_util_common.h"
+
+/**
+ * check_for_overlayfs:
+ *
+ * Determine if the mount point used by the tests for creating temporary
+ * files is using overlayfs.
+ *
+ * Returns: TRUE if temporary work area is on overlayfs, else FALSE.
+ **/
+int
+check_for_overlayfs (void)
+{
+	struct statfs  statbuf;
+	char           path[PATH_MAX];
+#define OVERLAYFS_SUPER_MAGIC 0x794c764f
+	int            found = FALSE;
+
+	/* Create a file in the temporary work area */
+	TEST_FILENAME (path);
+	fclose (fopen (path, "w"));
+
+	/* Check it exits */
+	assert0 (statfs (path, &statbuf));
+
+	if (statbuf.f_type == OVERLAYFS_SUPER_MAGIC) {
+		nih_warn ("Mountpoint for '%s' (needed by the Upstart tests) is an overlayfs "
+				"filesystem, which does not support inotify.",
+				path);
+		found = TRUE;
+	}
+
+	assert0 (unlink (path));
+
+	return found;
+}
+
+/**
+ * test_checks:
+ *
+ * Perform any checks necessary before real tests are run.
+ **/
+void
+test_checks (void)
+{
+	TEST_GROUP ("test environment");
+
+	/*
+	 * Warn (*) if overlayfs detected.
+	 *
+	 * (*) - Don't fail in the hope that one day someone might fix
+	 * overlayfs.
+	 */
+	TEST_FEATURE ("checking for overlayfs");
+	if (check_for_overlayfs ()) {
+		nih_warn ("Found overlayfs mounts");
+		nih_warn ("This environment will probably cause tests to fail mysteriously!!");
+		nih_warn ("See bug LP:#882147 for further details.");
+	}
+}
+
+int
+main (int   argc,
+      char *argv[])
+{
+	test_checks ();
+
+	return 0;
+}

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to