Closed Bug 862017 Opened 13 years ago Closed 13 years ago

port windows clobberer fixes to mozharness

Categories

(Release Engineering :: Applications: MozharnessCore, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mozilla, Assigned: mozilla)

References

Details

(Whiteboard: [mozharness][pending new win32 test slaves])

Attachments

(3 files, 4 obsolete files)

Blocks: 858797
Attached patch windows clobber -- hangs :( (obsolete) — Splinter Review
Ported to mozharness. Unfortunately, this hangs when running on w64-ix-slave22 (via ssh, at least). Needs investigation. I'm going to hold off on this for now.
Oops, I see a bug. s,dir,path,
Attached patch windows clobber -- working!! (obsolete) — Splinter Review
Attachment #738818 - Attachment is obsolete: true
Attached patch windows clobber, renamed (obsolete) — Splinter Review
This patch: * ports your clobberer fixes to mozharness, with some changes ** allows for non-existent paths or files to be sent to _rmdir_windows(), since that's how mozharness' rmtree() works (more analogous to rm -rf) Passes nosetests on mac and windows. Let me know if you have any questions.
Attachment #738839 - Attachment is obsolete: true
Attachment #738843 - Flags: review?(jhopkins)
Comment on attachment 738843 [details] [diff] [review] windows clobber, renamed >@@ -63,92 +67,91 @@ class ScriptMixin(object): > > def rmtree(self, path, log_level=INFO, error_level=ERROR, > exit_code=-1): > """ > Returns None for success, not None for failure > """ > self.log("rmtree: %s" % path, level=log_level) > if os.path.exists(path): Keep in mind that this os.path.exists check will fail if the path is longer than MAX_PATH. As long as nobody passes in an initial path that long then you won't have problems. If you do want to handle that condition, you'd need to: - check for os='nt' first - change the path to an absolute path - do os.path.exists('\\\\?\\' + path) >+ def _rmtree_windows(self, path): >+ """ Windows-specific rmtree that handles path lengths longer than MAX_PATH. >+ Ported from clobberer.py. >+ """ >+ self.info("Using _rmtree_windows ...") >+ assert self._is_windows() >+ path = os.path.realpath(path) > if not os.path.exists(path): > return Tested that this os.path.exists fails on a very long path because it is missing the '\\\\?\\' prefix like the other system calls. Other tests you should consider adding to your test suite: - test deletion of paths long than MAX_PATH (which would find missing instances of '\\\\?\\') - test deletion of read-only files (ensuring SetFileAttributesW works as expected)
Attachment #738843 - Flags: review?(jhopkins) → review-
(In reply to John Hopkins (:jhopkins) from comment #5) > Other tests you should consider adding to your test suite: > > - test deletion of paths long than MAX_PATH (which would find missing > instances of '\\\\?\\') > - test deletion of read-only files (ensuring SetFileAttributesW works as > expected) Do you know how I should go about doing this? I tried: 1) mkdir -p REALLY_LONG_PATH (got error) 2) unzip ZIPFILE (with a really long path, got error) I could try adding a really long path into mozharness itself, but if the rmtree code ever broke that would effectively burn our entire windows pool.
Attachment #738843 - Attachment is obsolete: true
Flags: needinfo?(jhopkins)
Aki: I used the attached script for my own testing of long path removal.
Flags: needinfo?(jhopkins)
Attached patch with testsSplinter Review
Attachment #739327 - Attachment is obsolete: true
Attachment #740416 - Flags: review?(jhopkins)
Comment on attachment 740416 [details] [diff] [review] with tests Looks good!
Attachment #740416 - Flags: review?(jhopkins) → review+
Comment on attachment 740416 [details] [diff] [review] with tests Backed out, because this adds a pywin32 dependency to mozharness, and our test slaves don't all have pywin32 installed for newer python. :'(
Attachment #740416 - Flags: checked-in+ → checked-in-
The new win32 test slaves (iX) will have pywin32 installed on py27. I can land this then.
Whiteboard: [mozharness] → [mozharness][pending new win32 test slaves]
As :catlee noted, I can also do a try import/except, and fall back to rmdir /s /q.
Sorry for all the reviews; the previous patch failed on test boxes due to lack of pywin32. This passed tests on both a win64 build machine and an xp test machine (no pywin32 on py27).
Attachment #740594 - Flags: review?(jhopkins)
Comment on attachment 740594 [details] [diff] [review] fall back to rmdir /s /q if there isn't any pywin32 One nit pick - the '\\\\?\\' prefix isn't needed when shelling out to DOS since it can't handle long paths anyway. + full_path = '\\\\?\\' + path + if not os.path.exists(full_path): return + if not PYWIN32: + if not os.path.isdir(full_path): + return self.run_command('del /F /Q "%s"' % full_path) + else: + return self.run_command('rmdir /S /Q "%s"' % full_path)
Attachment #740594 - Flags: review?(jhopkins) → review+
Comment on attachment 740594 [details] [diff] [review] fall back to rmdir /s /q if there isn't any pywin32 http://hg.mozilla.org/build/mozharness/rev/d25a66667956
Attachment #740594 - Flags: checked-in+
Merged m-c to Cedar to verify before merging to production.
In mozharness production.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Depends on: 867029
No longer depends on: 867029
Product: mozilla.org → Release Engineering
Component: General Automation → Mozharness
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: