Bug 181808 - run-test.py script should make sure 'node_modules' directory exist before installing
Summary: run-test.py script should make sure 'node_modules' directory exist before ins...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-18 12:41 PST by dewei_zhu
Modified: 2018-01-24 06:27 PST (History)
3 users (show)

See Also:


Attachments
Patch (1.96 KB, patch)
2018-01-18 12:42 PST, dewei_zhu
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.