Skip to content

Commit a9839a0

Browse files
committed
Update environment variables to avoid possible race conditions
1 parent 6b85840 commit a9839a0

File tree

6 files changed

+52
-25
lines changed

6 files changed

+52
-25
lines changed

tools/make/lib/docs/documentationjs.mk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ endif
1717
# TODO: add Windows command
1818

1919
# Define the command for recursively creating directories (WARNING: possible portability issues on some systems!):
20-
MKDIR ?= mkdir
21-
MKDIR_FLAGS ?= -p
20+
MKDIR_RECURSIVE ?= mkdir -p
2221

2322
# Define the path of the documentation.js executable:
2423
DOCUMENTATIONJS ?= $(BIN_DIR)/documentation
@@ -64,7 +63,7 @@ DOCUMENTATIONJS_JSON_FLAGS ?= --format json
6463

6564
documentationjs-html: $(NODE_MODULES)
6665
$(DELETE) $(DELETE_FLAGS) $(DOCUMENTATIONJS_HTML_OUT)
67-
$(MKDIR) $(MKDIR_FLAGS) $(DOCUMENTATIONJS_HTML_OUT)
66+
$(MKDIR_RECURSIVE) $(DOCUMENTATIONJS_HTML_OUT)
6867
$(DOCUMENTATIONJS) $(DOCUMENTATIONJS_HTML_FLAGS) $(DOCUMENTATIONJS_TYPEDEF) $(SOURCES)
6968

7069
.PHONY: documentationjs-html
@@ -82,7 +81,7 @@ documentationjs-html: $(NODE_MODULES)
8281

8382
documentationjs-json: $(NODE_MODULES)
8483
$(DELETE) $(DELETE_FLAGS) $(DOCUMENTATIONJS_JSON)
85-
$(MKDIR) $(MKDIR_FLAGS) $(DOCUMENTATIONJS_JSON_OUT)
84+
$(MKDIR_RECURSIVE) $(DOCUMENTATIONJS_JSON_OUT)
8685
$(DOCUMENTATIONJS) $(DOCUMENTATIONJS_JSON_FLAGS) $(DOCUMENTATIONJS_TYPEDEF) $(SOURCES) > $(DOCUMENTATIONJS_JSON)
8786

8887
.PHONY: documentationjs-json

tools/make/lib/docs/jsdoc.mk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ endif
1717
# TODO: add Windows command
1818

1919
# Define the command for recursively creating directories (WARNING: portability issues on some systems!):
20-
MKDIR ?= mkdir
21-
MKDIR_FLAGS ?= -p
20+
MKDIR_RECURSIVE ?= mkdir -p
2221

2322
# Define the path of the JSDoc executable:
2423
JSDOC ?= $(BIN_DIR)/jsdoc
@@ -79,7 +78,7 @@ JSDOC_JSON_FLAGS ?= \
7978

8079
jsdoc-html: $(NODE_MODULES)
8180
$(DELETE) $(DELETE_FLAGS) $(JSDOC_HTML_OUT)
82-
$(MKDIR) $(MKDIR_FLAGS) $(JSDOC_HTML_OUT)
81+
$(MKDIR_RECURSIVE) $(JSDOC_HTML_OUT)
8382
$(JSDOC) $(JSDOC_HTML_FLAGS) $(JSDOC_TYPEDEF) $(SOURCES)
8483

8584
.PHONY: jsdoc-html
@@ -96,7 +95,7 @@ jsdoc-html: $(NODE_MODULES)
9695

9796
jsdoc-json: $(NODE_MODULES)
9897
$(DELETE) $(DELETE_FLAGS) $(JSDOC_JSON)
99-
$(MKDIR) $(MKDIR_FLAGS) $(JSDOC_JSON_OUT)
98+
$(MKDIR_RECURSIVE) $(JSDOC_JSON_OUT)
10099
$(JSDOC) $(JSDOC_JSON_FLAGS) $(JSDOC_TYPEDEF) $(SOURCES) > $(JSDOC_JSON)
101100

102101
.PHONY: jsdoc-json

tools/make/lib/notes/Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
# VARIABLES #
33

44
# Define keywords identifying annotations:
5-
NOTES ?= 'TODO|FIXME|WARNING|HACK|NOTE|OPTIMIZE'
5+
KEYWORDS ?= 'TODO|FIXME|WARNING|HACK|NOTE|OPTIMIZE'
66

7-
# Define the command for `grep`:
8-
GREP ?= grep
7+
# Define the command for finding notes:
8+
FIND_NOTES ?= grep
99

10-
# Define the command-line options to use when invoking `grep`:
11-
GREP_FLAGS ?= -Ern
10+
# Define the command-line options:
11+
FIND_NOTES_FLAGS ?= -Ern
1212

1313
# Define the search directory:
14-
GREP_DIR ?= $(ROOT_DIR)
14+
FIND_NOTES_DIR ?= $(ROOT_DIR)
1515

1616

1717
# TARGETS #
@@ -21,7 +21,7 @@ GREP_DIR ?= $(ROOT_DIR)
2121
# This target searches for annotated comments which indicate work that remains to be completed. Annotated comments will be output, along with the filename and line number where they appear.
2222

2323
notes:
24-
$(GREP) $(GREP_FLAGS) $(NOTES) $(GREP_DIR) \
24+
$(FIND_NOTES) $(FIND_NOTES_FLAGS) $(KEYWORDS) $(FIND_NOTES_DIR) \
2525
--exclude-dir "$(NODE_MODULES)/*" \
2626
--exclude-dir "$(BUILD_DIR)/*" \
2727
--exclude "$(this_file)" \

tools/make/lib/test-browsers/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ BROWSERIFY ?= $(BIN_DIR)/browserify
1717
BROWSERIFY_PROXYQUIRE ?= $(NODE_MODULES)/proxyquire-universal
1818

1919
# Define command-line options to be used when invoking the browserify executable:
20-
BROWSERIFY_FLAGS ?= -p $(BROWSERIFY_PROXYQUIRE)
20+
BROWSERIFY_BROWSER_TEST_FLAGS ?= -p $(BROWSERIFY_PROXYQUIRE)
2121

2222
# Define the path to the `tap-spec` executable:
2323
TAP_REPORTER ?= $(BIN_DIR)/tap-spec
@@ -50,7 +50,7 @@ test-browsers: $(NODE_MODULES)
5050
NODE_ENV=$(NODE_ENV_TEST) \
5151
NODE_PATH=$(NODE_PATH_TEST) \
5252
$(BROWSERIFY) \
53-
$(BROWSERIFY_FLAGS) \
53+
$(BROWSERIFY_BROWSER_TEST_FLAGS) \
5454
$(TESTS) \
5555
| $(BROWSER_TEST) $(BROWSER_TEST_FLAGS) \
5656
| $(TAP_REPORTER)

tools/make/lib/test-cov/istanbul.mk

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Define the command to recursively sync directories:
55
RSYNC_RECURSIVE ?= rsync -r
66

7-
# Define the command to recursively create directories:
7+
# Define the command to recursively create directories (WARNING: possible portability issues on some systems!):
88
MKDIR_RECURSIVE ?= mkdir -p
99

1010
# Define the command for removing files and directories:
@@ -22,6 +22,24 @@ else
2222
endif
2323
# TODO: add Windows command
2424

25+
# On Mac OSX, in order to use `|` and other regular expression operators, we need to use enhanced regular expression syntax (-E); see https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man7/re_format.7.html#//apple_ref/doc/man/7/re_format.
26+
27+
ifeq ($(KERNEL), Darwin)
28+
find_kernel_prefix := -E
29+
else
30+
find_kernel_prefix :=
31+
endif
32+
33+
# Define command-line flags for finding test directories for instrumented source code:
34+
FIND_ISTANBUL_TESTS_DIRS_FLAGS ?= \
35+
-type d \
36+
-name "$(TESTS_FOLDER)" \
37+
-regex "$(TESTS_FILTER)"
38+
39+
ifneq ($(KERNEL), Darwin)
40+
FIND_ISTANBUL_TESTS_DIRS_FLAGS := -regextype posix-extended $(FIND_ISTANBUL_TESTS_DIRS_FLAGS)
41+
endif
42+
2543
# Define the path to the Istanbul executable.
2644
#
2745
# To install Istanbul:
@@ -77,6 +95,17 @@ ISTANBUL_COVER_FLAGS ?= \
7795
--report $(ISTANBUL_REPORT)
7896

7997

98+
# FUNCTIONS #
99+
100+
# Macro to retrieve a list of test directories for Istanbul instrumented source code.
101+
#
102+
# $(call get-istanbul-test-dirs)
103+
104+
define get-istanbul-test-dirs
105+
$(shell find $(find_kernel_prefix) $(ISTANBUL_INSTRUMENT_OUT) $(FIND_ISTANBUL_TESTS_DIRS_FLAGS))
106+
endef
107+
108+
80109
# TARGETS #
81110

82111
# Instruments source code.
@@ -98,14 +127,14 @@ test-istanbul-instrument: $(NODE_MODULES) clean-istanbul-instrument
98127
#
99128
# This target instruments source code, runs unit tests, and outputs a test coverage report.
100129

101-
test-istanbul: $(NODE_MODULES)
102-
for dir in $(TESTS_DIRS); do \
130+
test-istanbul: $(NODE_MODULES) test-istanbul-instrument
131+
for dir in $(get-istanbul-test-dirs); do \
103132
echo ''; \
104133
echo "Running tests in directory: $$dir"; \
105134
echo ''; \
106135
NODE_ENV=$(NODE_ENV_TEST) \
107136
NODE_PATH=$(NODE_PATH_TEST) \
108-
$(ISTANBUL_COVER) $(ISTANBUL_COVER_FLAGS) $(JAVASCRIPT_TEST) -- $(JAVASCRIPT_TEST_FLAGS) $$dir/**/$(TESTS_PATTERN); \
137+
$(JAVASCRIPT_TEST) $(JAVASCRIPT_TEST_FLAGS) $$dir/**/$(TESTS_PATTERN); \
109138
done
110139

111140
.PHONY: test-istanbul

tools/make/lib/workshops/numeric_computing.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ endif
2525
XSLIDE ?= $(BIN_DIR)/xslide
2626

2727
# Define the port for viewing slides:
28-
XSLIDE_PORT ?= 8001
28+
XSLIDE_WORKSHOP_PORT ?= 8001
2929

3030
# Define the command-line options to be used when invoking the `xslide` executable:
31-
XSLIDE_FLAGS ?= -p $(XSLIDE_PORT)
31+
XSLIDE_WORKSHOP_FLAGS ?= -p $(XSLIDE_WORKSHOP_PORT)
3232

3333
# Define the slide directory:
3434
NUMERIC_COMPUTING_SLIDES_DIR ?= $(WORKSHOPS_DIR)/numeric-computing/slides
@@ -44,7 +44,7 @@ NUMERIC_COMPUTING_SLIDES ?= $(NUMERIC_COMPUTING_SLIDES_DIR)/00.md
4444
# This target launches a server for viewing workshop slides.
4545

4646
workshops-numeric-computing-slides: $(NODE_MODULES)
47-
$(XSLIDE) $(NUMERIC_COMPUTING_SLIDES) $(XSLIDE_FLAGS)
47+
$(XSLIDE) $(NUMERIC_COMPUTING_SLIDES) $(XSLIDE_WORKSHOP_FLAGS)
4848

4949
.PHONY: workshops-numeric-computing-slides
5050

@@ -54,6 +54,6 @@ workshops-numeric-computing-slides: $(NODE_MODULES)
5454
# This target opens workshop slides in a local web browser.
5555

5656
view-workshops-numeric-computing-slides:
57-
$(OPEN) http://localhost:$(XSLIDE_PORT)
57+
$(OPEN) http://localhost:$(XSLIDE_WORKSHOP_PORT)
5858

5959
.PHONY: view-workshops-numeric-computing-slides

0 commit comments

Comments
 (0)