Unit Tests Failing on Ubuntu and Solaris (but not Mac OS X)

75 views
Skip to first unread message

Pete Johns

unread,
Aug 8, 2008, 8:01:41 PM8/8/08
to Google C++ Testing Framework
Hi there,

I built gtest on three different machines after discovering it
yesterday. When I invoke `make check` I get three failures. The first
has been described elsewhere <http://code.google.com/p/googletest/
issues/detail?id=9> and I have fixed that locally.

The second two are due to a race condition with certain file systems
(and are the same problem):


F
======================================================================
FAIL: testOutfile1 (__main__.GTestXMLOutFilesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./test/gtest_xml_outfiles_test.py", line 95, in testOutfile1
self._TestOutFile(GTEST_OUTPUT_1_TEST, EXPECTED_XML_1)
File "./test/gtest_xml_outfiles_test.py", line 118, in _TestOutFile
output_file1)
AssertionError: /home/paj/tmp/tmpDl2enP/gtest_xml_outfile1_test_.xml

======================================================================
FAIL: testOutfile2 (__main__.GTestXMLOutFilesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./test/gtest_xml_outfiles_test.py", line 98, in testOutfile2
self._TestOutFile(GTEST_OUTPUT_2_TEST, EXPECTED_XML_2)
File "./test/gtest_xml_outfiles_test.py", line 118, in _TestOutFile
output_file1)
AssertionError: /home/paj/tmp/tmpTD61Zm/gtest_xml_outfile2_test_.xml

----------------------------------------------------------------------
Ran 2 tests in 0.159s

FAILED (failures=2)
FAIL: test/gtest_xml_outfiles_test.py

According to these tests, the files have not (yet) been created on the
file system. However, running `ls` afterwards shows that they do
exist:

> ls -l /home/paj/tmp/tmpDl2enP/ /home/paj/tmp/tmpTD61Zm/
/home/paj/tmp/tmpDl2enP/:
total 12
drwxr-xr-x 2 paj 4096 2008-08-09 09:42 ./
drwxr-xr-x 38 paj 4096 2008-08-09 09:42 ../
-rw-r--r-- 1 paj 381 2008-08-09 09:42 lt-
gtest_xml_outfile1_test_.xml

/home/paj/tmp/tmpTD61Zm/:
total 12
drwxr-xr-x 2 paj 4096 2008-08-09 09:42 ./
drwxr-xr-x 38 paj 4096 2008-08-09 09:42 ../
-rw-r--r-- 1 paj 381 2008-08-09 09:42 lt-
gtest_xml_outfile2_test_.xml

This failure is on Linux gaspode 2.6.24-19-generic #1 SMP Wed Jun 18
14:43:41 UTC 2008 i686 GNU/Linux

Perhaps these checks should be performed in-memory, rather than
relying on a file system (c.f. http://www.google.com/search?q=a-test-is-not-a-unit-test-if
;-) ).

Best;


--paj

Zhanyong Wan (λx.x x)

unread,
Aug 8, 2008, 8:46:50 PM8/8/08
to Pete Johns, Google C++ Testing Framework
Thanks for the report, Pete!

None of us working on Google Test has access to Solaris, so that's
kinda of an unsupported platform. If you could find a fix on your
machine and submit a patch (read
http://code.google.com/p/googletest/wiki/GoogleTestDevGuide on how),
we'll work with you to incorporate it after reviewing and testing it.

Could you log an issue for the failing XML output file test?

While in-memory tests have many benefits, they cannot completely
replace testing the real scenario. Therefore it's still necessary to
have some tests to cover real file systems.

The failures you saw shouldn't affect Google Test's normal functioning
and the correctness of the test results, so you can still use Google
Test before the tests are fixed.

Thanks,

--
Zhanyong

Vlad Losev

unread,
Aug 8, 2008, 10:24:55 PM8/8/08
to Zhanyong Wan (λx.x x), Pete Johns, Google C++ Testing Framework
Zhanyong -

I can confirm the issue on Ubuntu 8.04 in release 1.0.1. I have updated the bug in the tracker with more information.

- Vlad

_______________________________________________
opensource-gtest mailing list
opensour...@google.com
https://mailman.corp.google.com/mailman/listinfo/opensource-gtest

Pete Johns

unread,
Aug 9, 2008, 4:44:18 AM8/9/08
to Google C++ Testing Framework
On Aug 9, 12:24 pm, "Vlad Losev" <vl...@google.com> wrote:
> I can confirm the issue on Ubuntu 8.04 in release 1.0.1. I have updated the
> bug in the tracker with more information.
>
Thanks Vlad.

I took a look at your comment on the bug <http://code.google.com/p/
googletest/issues/detail?id=9&q=xml#c4>, but you do not seem to be
describing the problem that I am experiencing. The file
(output_file_name2) *is* written in the correct directory
(output_dir_), but it is not ready for reading when the assertion is
called.

The following patch highlights the problem by waiting (and printing
dots) until the file appears.

If I get a chance to fix this over the weekend, I shall submit a
patch. I can confirm that the problem is the same on both Ubuntu and
Solaris.

Best;


--paj

Index: gtest_xml_outfiles_test.py
===================================================================
--- gtest_xml_outfiles_test.py (revision 78)
+++ gtest_xml_outfiles_test.py (working copy)
@@ -114,6 +114,8 @@
output_file1 = os.path.join(self.output_dir_, output_file_name1)
output_file_name2 = 'lt-' + output_file_name1
output_file2 = os.path.join(self.output_dir_, output_file_name2)
+ while not (os.path.isfile(output_file1) or
os.path.isfile(output_file2)):
+ print '.',
self.assert_(os.path.isfile(output_file1) or
os.path.isfile(output_file2),
output_file1)
Reply all
Reply to author
Forward
0 new messages