mozbuild: backend/recursivemake.py - backend_file.write() buffering problem

RESOLVED WORKSFORME

Status

()

Core
Build Config
RESOLVED WORKSFORME
5 years ago
5 years ago

People

(Reporter: joey, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
From bug # 870366
http://bugzilla.mozilla.org/show_bug.cgi?id=870366

backend_file.write() seems to not be flushing the final written line to disk.
writing an extra newline is the difference between this unit test passing or failing:

elif isinstance(obj, JSPreferenceFiles):
    backend_file.write('PREF_JS_EXPORTS = %s\n' % obj.js_preference_files)
    backend_file.write('\n') # intentional: workaround until buffering problem fixed.


With extra newline to force flushing:
=====================================
TEST-PASS | /media/_Q/mozilla/bugs/870366/python/mozbuild/mozbuild/test/backend/test_recursivemake.py | test_xpcshell_master_manifest
CALLING: write PREF_JS_EXPORTS = [aa/aa.js]
CALLING: write PREF_JS_EXPORTS = [bb/bb.js]
CALLING: write PREF_JS_EXPORTS = [cc/cc.js]
CALLING: write PREF_JS_EXPORTS = [dd/dd.js]
CALLING: write PREF_JS_EXPORTS = [valid_val/pref.js]
==================================================
backend.mk
['PREF_JS_EXPORTS = aa/aa.js', 'PREF_JS_EXPORTS = bb/bb.js', 'PREF_JS_EXPORTS = cc/cc.js', 'PREF_JS_EXPORTS = dd/dd.js', 'PREF_JS_EXPORTS = valid_val/pref.js']
==================================================


# Without backend_file.write('\n')
==================================

[870366] cat ~/bad 
TEST-UNEXPECTED-FAIL | /media/_Q/mozilla/bugs/870366/python/mozbuild/mozbuild/test/backend/test_recursivemake.py | line 243, test_js_preference_files: Lists differ: ['PREF_JS_EXPORTS = aa/aa.js',... != ['PREF_JS_EXPORTS = aa/aa.js',...

Second list contains 1 additional elements.
First extra element 4:
PREF_JS_EXPORTS = valid_val/pref.js

  ['PREF_JS_EXPORTS = aa/aa.js',
   'PREF_JS_EXPORTS = bb/bb.js',
   'PREF_JS_EXPORTS = cc/cc.js',
-  'PREF_JS_EXPORTS = dd/dd.js']
?                              ^

+  'PREF_JS_EXPORTS = dd/dd.js',
?                              ^

+  'PREF_JS_EXPORTS = valid_val/pref.js']
TEST-PASS | /media/_Q/mozilla/bugs/870366/python/mozbuild/mozbuild/test/backend/test_recursivemake.py | test_makefile_conversion

[snip]

TEST-PASS | /media/_Q/mozilla/bugs/870366/python/mozbuild/mozbuild/test/backend/test_recursivemake.py | test_xpcshell_master_manifest
CALLING: write PREF_JS_EXPORTS = [aa/aa.js]
CALLING: write PREF_JS_EXPORTS = [bb/bb.js]
CALLING: write PREF_JS_EXPORTS = [cc/cc.js]
CALLING: write PREF_JS_EXPORTS = [dd/dd.js]
CALLING: write PREF_JS_EXPORTS = [valid_val/pref.js]
==================================================
backend.mk
['PREF_JS_EXPORTS = aa/aa.js', 'PREF_JS_EXPORTS = bb/bb.js', 'PREF_JS_EXPORTS = cc/cc.js', 'PREF_JS_EXPORTS = dd/dd.js']
==================================================
gmake: *** [run-/media/_Q/mozilla/bugs/870366/python/mozbuild/mozbuild/test/backend/test_recursivemake.py] Error 1
(Reporter)

Updated

5 years ago
See Also: → bug 870366

Comment 1

5 years ago
I suspect this is just the test code not reading the file properly. The files should all be closed by the time the test code opens and reads them. I highly doubt there is a buffering issue.

Comment 2

5 years ago
I strongly feel this was the result of user error. If we had a buffering problem writing backend.mk files, we'd see all kinds of random failures. We haven't.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.