[oe-commits] Mike Crowe : sanity: Use random filename for maximum path length test

git at git.openembedded.org git at git.openembedded.org
Mon Nov 25 16:13:54 UTC 2013


Module: openembedded-core.git
Branch: master
Commit: bc28e3f26e7f85af82f403924c0ae29e1ad34a87
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=bc28e3f26e7f85af82f403924c0ae29e1ad34a87

Author: Mike Crowe <mac at mcrowe.com>
Date:   Mon Nov 25 15:20:14 2013 +0000

sanity: Use random filename for maximum path length test

check_create_long_filename used a fixed filename for its test files. This
meant that os.remove(testfile) could fail with ENOENT if two instances were
running at the same time against the same sstate directory. Using a
randomly generated filename stops this from happening.

(Although it might seem unlikely, this race did appear to occur multiple
times with Jenkins - presumably because the matrix jobs were all kicked off
at the same time.)

Signed-off-by: Mike Crowe <mac at mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/sanity.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index b26ea6b..8531df1 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -175,7 +175,8 @@ def check_conf_exists(fn, data):
     return False
 
 def check_create_long_filename(filepath, pathname):
-    testfile = os.path.join(filepath, ''.join([`num`[-1] for num in xrange(1,200)]))
+    import string, random
+    testfile = os.path.join(filepath, ''.join(random.choice(string.ascii_letters) for x in range(200)))
     try:
         if not os.path.exists(filepath):
             bb.utils.mkdirhier(filepath)



More information about the Openembedded-commits mailing list