Opened 17 years ago
Closed 16 years ago
#231 closed defect (fixed)
[PATCH] gcov prefix always includes hyphen
Reported by: | hefloryd | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.6 |
Component: | Recipe commands | Version: | 0.5.3 |
Keywords: | gcov | Cc: | |
Operating System: | Linux |
Description
The gcov command is unable to find object files that are kept in separate folders from the source files.
The command takes a prefix argument. The prefix could be used to set the relative path from the source files to the object files. For instance, if the object files are kept in a subdirectory obj, then prefix could be set to obj/, and the procedure would find the correct object.
In the current implementation however, a hyphen is always included between the prefix and the stem of the filename, so if prefix is set like above the end result would be obj/-file.o.
The following trivial patch removes the hyphen so prefix can be used like above. If the hyphen is needed it can always be included in the prefix argument itself.
Alternatively, to avoid breaking existing recipes, a new relative path argument could be added.
Index: bitten/build/ctools.py =================================================================== --- bitten/build/ctools.py (revision 519) +++ bitten/build/ctools.py (working copy) @@ -179,7 +179,7 @@ filepath, filename = os.path.split(srcfile) stem = os.path.splitext(filename)[0] if prefix is not None: - stem = prefix + '-' + stem + stem = prefix + stem objfile = os.path.join(filepath, stem + '.o') if not os.path.isfile(ctxt.resolve(objfile)):
Attachments (2)
Change History (6)
Changed 17 years ago by Jérôme Berger <jeberger@…>
comment:1 Changed 17 years ago by Jérôme Berger <jeberger@…>
- Summary changed from gcov prefix always includes hyphen to [PATCH] gcov prefix always includes hyphen
The attached patch adds a new root argument. Moreover it works even if the soruce files are distributed between several subfolders of the current path (assuming the objects follow the same folder hierarchy below root) instead of being all in the same folder.
comment:2 follow-up: ↓ 3 Changed 16 years ago by wbell
Patch looks good-- breaks some tests. Will apply when it applies cleanly:
====================================================================== FAIL: test_no_file (bitten.build.tests.ctools.GCovTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\bitten\bitten\bitten\build\tests\ctools.py", line 110, in test_no_file self.assertEqual('report', type) AssertionError: 'report' != 'log' ====================================================================== FAIL: test_single_file (bitten.build.tests.ctools.GCovTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\bitten\bitten\bitten\build\tests\ctools.py", line 134, in test_single_file self.assertEqual('report', type) AssertionError: 'report' != 'log' ---------------------------------------------------------------------- Ran 198 tests in 2.766s
comment:3 in reply to: ↑ 2 Changed 16 years ago by Jérôme M. Berger <jeberger@…>
Replying to wbell:
Patch looks good-- breaks some tests. Will apply when it applies cleanly:
Here you go. The problem came from the fact that the patch sends some log messages in addition to the raw coverage results. I've modified the test to check that those logs are present before it checks the results.
comment:4 Changed 16 years ago by wbell
- Resolution set to fixed
- Status changed from new to closed
Applied in [571]. Thanks!
Patch against trunk revision 519.