Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b5e18f2

Browse filesBrowse files
danbevMylesBorins
authored andcommitted
tools: add macosx-firwall script to avoid popups
Currently, there are a number of popups that get displayed when running the tests asking to accept incoming network connections. Rules can be added manually to the socket firewall on Mac OS X but getting this right might not be obvious and quite a lot of time can be wasted trying to get the rules right. This script hopes to simplify things a little so that it can be re-run when needed. The script should be runnable from both the projects root directory and from the tools directory, for example: $ sudo ./tools/macosx-firewall.sh Fixes: #8911 PR-URL: #10114 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 210290d commit b5e18f2
Copy full SHA for b5e18f2

File tree

Expand file treeCollapse file tree

2 files changed

+57
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+57
-0
lines changed
Open diff view settings
Collapse file

‎BUILDING.md‎

Copy file name to clipboardExpand all lines: BUILDING.md
+9Lines changed: 9 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ On OS X, you will also need:
2424
this under the menu `Xcode -> Preferences -> Downloads`
2525
* This step will install `gcc` and the related toolchain containing `make`
2626

27+
* You may want to setup [firewall rules](tools/macosx-firewall.sh) to avoid
28+
popups asking to accept incoming network connections when running tests:
29+
30+
```console
31+
$ sudo ./tools/macosx-firewall.sh
32+
```
33+
Running this script will add rules for the executable `node` in the out
34+
directory and the symbolic `node` link in the projects root directory.
35+
2736
On FreeBSD and OpenBSD, you may also need:
2837
* libexecinfo (FreeBSD and OpenBSD only)
2938

Collapse file

‎tools/macosx-firewall.sh‎

Copy file name to clipboard
+48Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# Script that adds rules to Mac OS X Socket Firewall to avoid
3+
# popups asking to accept incoming network connections when
4+
# running tests.
5+
SFW="/usr/libexec/ApplicationFirewall/socketfilterfw"
6+
TOOLSDIR="`dirname \"$0\"`"
7+
TOOLSDIR="`( cd \"$TOOLSDIR\" && pwd) `"
8+
ROOTDIR="`( cd \"$TOOLSDIR/..\" && pwd) `"
9+
OUTDIR="$TOOLSDIR/../out"
10+
# Using cd and pwd here so that the path used for socketfilterfw does not
11+
# contain a '..', which seems to cause the rules to be incorrectly added
12+
# and they are not removed when this script is re-run. Instead the new
13+
# rules are simply appended. By using pwd we can get the full path
14+
# without '..' and things work as expected.
15+
OUTDIR="`( cd \"$OUTDIR\" && pwd) `"
16+
NODE_RELEASE="$OUTDIR/Release/node"
17+
NODE_DEBUG="$OUTDIR/Debug/node"
18+
NODE_LINK="$ROOTDIR/node"
19+
CCTEST_RELEASE="$OUTDIR/Release/cctest"
20+
CCTEST_DEBUG="$OUTDIR/Debug/cctest"
21+
22+
if [ -f $SFW ];
23+
then
24+
# Duplicating these commands on purpose as the symbolic link node might be
25+
# linked to either out/Debug/node or out/Release/node depending on the
26+
# BUILDTYPE.
27+
$SFW --remove "$NODE_DEBUG"
28+
$SFW --remove "$NODE_DEBUG"
29+
$SFW --remove "$NODE_RELEASE"
30+
$SFW --remove "$NODE_RELEASE"
31+
$SFW --remove "$NODE_LINK"
32+
$SFW --remove "$CCTEST_DEBUG"
33+
$SFW --remove "$CCTEST_RELEASE"
34+
35+
$SFW --add "$NODE_DEBUG"
36+
$SFW --add "$NODE_RELEASE"
37+
$SFW --add "$NODE_LINK"
38+
$SFW --add "$CCTEST_DEBUG"
39+
$SFW --add "$CCTEST_RELEASE"
40+
41+
$SFW --unblock "$NODE_DEBUG"
42+
$SFW --unblock "$NODE_RELEASE"
43+
$SFW --unblock "$NODE_LINK"
44+
$SFW --unblock "$CCTEST_DEBUG"
45+
$SFW --unblock "$CCTEST_RELEASE"
46+
else
47+
echo "SocketFirewall not found in location: $SFW"
48+
fi

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.