Merge lp:~vorlon/upstart/check-for-overlayfs into lp:upstart

Proposed by Steve Langasek
Status: Merged
Merged at revision: 1560
Proposed branch: lp:~vorlon/upstart/check-for-overlayfs
Merge into: lp:upstart
Diff against target: 174 lines (+133/-2) (has conflicts)
4 files modified
ChangeLog (+16/-0)
test/Makefile.am (+14/-1)
test/test_util_common.c (+1/-1)
test/tests/test_util_check_env.c (+102/-0)
Text conflict in ChangeLog
To merge this branch: bzr merge lp:~vorlon/upstart/check-for-overlayfs
Reviewer Review Type Date Requested Status
James Hunt Approve
Review via email: mp+193726@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Hunt (jamesodhunt) wrote :

On reflection, we have 2 working implementations, so let's adopt the most efficient :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2013-11-03 02:56:57 +0000
+++ ChangeLog 2013-11-04 01:15:45 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
12013-10-25 Steve Langasek <steve.langasek@ubuntu.com>22013-10-25 Steve Langasek <steve.langasek@ubuntu.com>
23
3 * init/main.c, init/system.c, init/system.h: allow mount options4 * init/main.c, init/system.c, init/system.h: allow mount options
@@ -88,6 +89,21 @@
88 running in user mode (for 'check-config').89 running in user mode (for 'check-config').
8990
902013-10-04 Steve Langasek <steve.langasek@ubuntu.com>912013-10-04 Steve Langasek <steve.langasek@ubuntu.com>
92=======
932013-10-17 James Hunt <james.hunt@ubuntu.com>
94
95 * test/tests/test_util_check_env.c:
96 - check_for_overlayfs(): Only consider temporary work area.
97
982013-10-16 James Hunt <james.hunt@ubuntu.com>
99
100 * test/tests/test_util_check_env.c: New test to look for
101 overlayfs filesystems which could cause tests to fail.
102 * test/Makefile.am: Added test_util_check_env meta-test.
103 * test/test_util_common.c: Formatting.
104
1052013-10-04 Steve Langasek <steve.langasek@ubuntu.com
106>>>>>>> MERGE-SOURCE
91107
92 * extra/upstart-local-bridge.c: use SOCKET_PATH in our event108 * extra/upstart-local-bridge.c: use SOCKET_PATH in our event
93 environment, instead of clobbering PATH. (LP: #1235480)109 environment, instead of clobbering PATH. (LP: #1235480)
94110
=== 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 @@
18 -I$(top_srcdir)/intl18 -I$(top_srcdir)/intl
1919
20check_LIBRARIES = libtest_util_common.a20check_LIBRARIES = libtest_util_common.a
21libtest_util_common_a_SOURCES = test_util_common.c test_util_common.h21libtest_util_common_a_SOURCES = \
22 test_util_common.c \
23 test_util_common.h
24
25TESTS = test_util_check_env
26check_PROGRAMS = $(TESTS)
27
28.PHONY: tests
29tests: $(check_PROGRAMS)
30
31test_util_check_env_SOURCES = tests/test_util_check_env.c
32test_util_check_env_LDADD = \
33 libtest_util_common.a \
34 $(NIH_LIBS)
2235
=== 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 @@
162 * within a reasonable period of time.162 * within a reasonable period of time.
163 */163 */
164 for (i = 0; i < loops; i++) {164 for (i = 0; i < loops; i++) {
165 sleep (1);165 sleep (1);
166166
167 RUN_COMMAND (NULL, cmd, &output, &lines);167 RUN_COMMAND (NULL, cmd, &output, &lines);
168168
169169
=== 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 @@
1/* upstart
2 *
3 * test_util_check_env.c - meta test to ensure environment sane for
4 * running tests.
5 *
6 * Copyright © 2013 Canonical Ltd.
7 * Author: James Hunt <james.hunt@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include <stdio.h>
24#include <stdlib.h>
25#include <sys/stat.h>
26#include <limits.h>
27#include <unistd.h>
28#include <mntent.h>
29
30#include <nih/string.h>
31#include <nih/test.h>
32#include <nih/logging.h>
33
34#include "test_util_common.h"
35
36/**
37 * check_for_overlayfs:
38 *
39 * Determine if the mount point used by the tests for creating temporary
40 * files is using overlayfs.
41 *
42 * Returns: TRUE if temporary work area is on overlayfs, else FALSE.
43 **/
44int
45check_for_overlayfs (void)
46{
47 struct statfs statbuf;
48 char path[PATH_MAX];
49#define OVERLAYFS_SUPER_MAGIC 0x794c764f
50 int found = FALSE;
51
52 /* Create a file in the temporary work area */
53 TEST_FILENAME (path);
54 fclose (fopen (path, "w"));
55
56 /* Check it exits */
57 assert0 (statfs (path, &statbuf));
58
59 if (statbuf.f_type == OVERLAYFS_SUPER_MAGIC) {
60 nih_warn ("Mountpoint for '%s' (needed by the Upstart tests) is an overlayfs "
61 "filesystem, which does not support inotify.",
62 path);
63 found = TRUE;
64 }
65
66 assert0 (unlink (path));
67
68 return found;
69}
70
71/**
72 * test_checks:
73 *
74 * Perform any checks necessary before real tests are run.
75 **/
76void
77test_checks (void)
78{
79 TEST_GROUP ("test environment");
80
81 /*
82 * Warn (*) if overlayfs detected.
83 *
84 * (*) - Don't fail in the hope that one day someone might fix
85 * overlayfs.
86 */
87 TEST_FEATURE ("checking for overlayfs");
88 if (check_for_overlayfs ()) {
89 nih_warn ("Found overlayfs mounts");
90 nih_warn ("This environment will probably cause tests to fail mysteriously!!");
91 nih_warn ("See bug LP:#882147 for further details.");
92 }
93}
94
95int
96main (int argc,
97 char *argv[])
98{
99 test_checks ();
100
101 return 0;
102}

Subscribers

People subscribed via source and target branches