Steve Langasek has proposed merging lp:~vorlon/upstart/more-log-flushing-tests into lp:upstart.
Requested reviews: Upstart Reviewers (upstart-reviewers) For more details, see: https://code.launchpad.net/~vorlon/upstart/more-log-flushing-tests/+merge/196432 As with lp:~vorlon/upstart/flaky-log-serialization-test, some of the tests in test_log.c fail because they assume the specified log file will not be writable. This is not always the case, even if the target file is in the root directory! So instead, if we don't want the log to be flushed, create our own file and make sure it's inacessible. -- https://code.launchpad.net/~vorlon/upstart/more-log-flushing-tests/+merge/196432 Your team Upstart Reviewers is requested to review the proposed merge of lp:~vorlon/upstart/more-log-flushing-tests into lp:upstart.
=== modified file 'ChangeLog' --- ChangeLog 2013-11-18 10:31:21 +0000 +++ ChangeLog 2013-11-23 22:24:34 +0000 @@ -1,3 +1,10 @@ +2013-11-23 Steve Langasek <[email protected]> + + * init/tests/test_log.c: don't assume the root filesystem is not + writable. If we want to make sure log data stays in the buffer + instead of being flushed to disk, create a log file that we + control and know can't be written to. + 2013-11-16 Dmitrijs Ledkovs <[email protected]> * init/xdg.c, util/Makefile.am, test/Makefile.am, init/conf.c: === modified file 'init/tests/test_log.c' --- init/tests/test_log.c 2013-06-25 09:19:05 +0000 +++ init/tests/test_log.c 2013-11-23 22:24:34 +0000 @@ -1136,6 +1136,8 @@ int pty_master; int pty_slave; int found_fd; + char filename[1024]; + int fd; TEST_FUNCTION ("log_destroy"); @@ -1179,7 +1181,16 @@ TEST_EQ (openpty (&pty_master, &pty_slave, NULL, NULL, NULL), 0); - log = log_new (NULL, "/bar", pty_master, 0); + TEST_FILENAME (filename); + + /* Make file inaccessible to ensure data cannot be written + * and will thus be added to the unflushed buffer. + */ + fd = open (filename, O_CREAT | O_EXCL, 0); + TEST_NE (fd, -1); + close (fd); + + log = log_new (NULL, filename, pty_master, 0); TEST_NE_P (log, NULL); ret = write (pty_slave, str, strlen (str)); @@ -1200,7 +1211,7 @@ TEST_EQ (openpty (&pty_master, &pty_slave, NULL, NULL, NULL), 0); - log = log_new (NULL, "/bar", pty_master, 0); + log = log_new (NULL, filename, pty_master, 0); TEST_NE_P (log, NULL); found_fd = 0; @@ -1238,6 +1249,8 @@ } } + TEST_EQ (unlink (filename), 0); + /* Freeing the log object should have removed the watch */ TEST_EQ (found_fd, 0);
-- upstart-devel mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel
