From: Alexis Campailla Date: Thu, 19 Dec 2013 15:55:06 +0000 (-0800) Subject: test: fix flaky unit test test-fs-realpath.js X-Git-Tag: v0.11.10~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f030d8426aa3241ad180c385f15134548579e7ce;p=platform%2Fupstream%2Fnodejs.git test: fix flaky unit test test-fs-realpath.js The test was not performing proper cleanup and so it would fail if run more than one time on the same machine. --- diff --git a/test/simple/test-fs-realpath.js b/test/simple/test-fs-realpath.js index f52fa7b..0c82090 100644 --- a/test/simple/test-fs-realpath.js +++ b/test/simple/test-fs-realpath.js @@ -410,6 +410,17 @@ function test_up_multiple(cb) { console.log('skipping symlink test (no privs)'); return runNextTest(); } + function cleanup() { + ['a/b', + 'a' + ].forEach(function(folder) { + try {fs.rmdirSync(tmp(folder))} catch (ex) {} + }); + } + function setup() { + cleanup(); + } + setup(); fs.mkdirSync(tmp('a'), 0755); fs.mkdirSync(tmp('a/b'), 0755); fs.symlinkSync('..', tmp('a/d'), 'dir'); @@ -432,6 +443,7 @@ function test_up_multiple(cb) { if (er) throw er; assert.equal(abedabed_real, real); cb(); + cleanup(); }); }); }