Skip to content

Commit

Permalink
Use iptables equivalent in macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaponte committed Aug 17, 2023
1 parent e6adb73 commit 8aa862f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions client_side_tests/test_fetch_content_recompile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ cmake --build build
rm -f build/client_exe # Make sure the executable does not exist unless we recompile

# Block network access temporarily
sudo iptables -A OUTPUT -j DROP
if [[ $OSTYPE == "darwin"* ]]; then
sudo pfctl -e
echo "block out all" | sudo pfctl -f -
else
sudo iptables -A OUTPUT -j DROP
fi

cmake -S $test_dir/client_fetch_content -B build; status1=$?
cmake --build build; status2=$?
./build/client_exe; status3=$?

# Restore network access
sudo iptables -D OUTPUT -j DROP
if [[ $OSTYPE == "darwin"* ]]; then
sudo pfctl -d
else
sudo iptables -A OUTPUT -j DROP
fi

(( status = status1 | status2 | status3 ))
exit $status

0 comments on commit 8aa862f

Please sign in to comment.