Bug 181808

Summary: run-test.py script should make sure 'node_modules' directory exist before installing
Product: WebKit Reporter: dewei_zhu
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: aakash_jain, dewei_zhu, rniwa
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=182040
Attachments:
Description Flags
Patch rniwa: review+

Description dewei_zhu 2018-01-18 12:41:06 PST
run-test.py script should make sure 'node_modules' directory exist before installing
Comment 1 dewei_zhu 2018-01-18 12:42:23 PST
Created attachment 331651 [details]
Patch
Comment 2 Aakash Jain 2018-01-23 20:25:55 PST
This change causes unit-tests to fail as mkdir fails when the directory already exists.

[~]$ tools/run-tests.py unit-tests
Traceback (most recent call last):
  File "tools/run-tests.py", line 25, in <module>
    main()
  File "tools/run-tests.py", line 13, in main
    os.makedirs(node_modules_dir)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/Volume/Data/OpenSource/Websites/perf.webkit.org/node_modules'
Comment 3 Aakash Jain 2018-01-23 20:27:18 PST
Referring to https://trac.webkit.org/changeset/227395/webkit
Comment 4 Aakash Jain 2018-01-23 20:40:48 PST
Comment on attachment 331651 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=331651&action=review

> Websites/perf.webkit.org/tools/run-tests.py:13
> +    os.makedirs(node_modules_dir)

This fails when the directory already exists. Should check first if the directory exists. e.g.:

if not os.path.exists(node_modules_dir):
    os.makedirs(node_modules_dir)
Comment 5 dewei_zhu 2018-01-24 00:34:29 PST
Comment on attachment 331651 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=331651&action=review

>> Websites/perf.webkit.org/tools/run-tests.py:13
>> +    os.makedirs(node_modules_dir)
> 
> This fails when the directory already exists. Should check first if the directory exists. e.g.:
> 
> if not os.path.exists(node_modules_dir):
>     os.makedirs(node_modules_dir)

You are right. I'll land the fix.