firewall – How to unlock an application with socketfilterfw?

I compile software from scratch and run its tests. I do it often. The tests open ports and wait for connections.

Every time I run the tests, I get the

Do you want the "test-test" application to accept incoming network connections?
Clicking Decline may limit the behavior of the application. This setting can be changed in the Firewall pane of the Security and Privacy preferences.

dialog box. I click Allow every time. To avoid this, I try to unlock the application with socketfilterfw. So, I try the following commands in a script file

SFW = "/ usr / libexec / ApplicationFirewall / socketfilterfw"
TESTS_DEBUG = "/ Users / thefourtheye / git / libuv / out / Debug / run-tests"
$ {SFW} --remove "$ TESTS_DEBUG"
$ {SFW} --add "$ TESTS_DEBUG"
$ {SFW} --unblock "$ TESTS_DEBUG"

Whenever I run the script file, it always gives the following

The application is not part of the firewall
Application on the path (/ Users / thefourtheye / git / libuv / out / Debug / run-tests) added to the firewall
The application is not part of the firewall 

If I run my tests after that, the dialog box remains displayed.

the TESTS_DEBUG The file is not a link, it is an executable binary file.

➜ libuv git: (v1.x) ✗ file / users / thefourtheye / git / libuv / out / Debug / run-tests
/ Users / thefourtheye / git / libuv / out / Debug / run-tests: 64-bit Mach-O Executable x86_64
➜ libuv git: (v1.x) ✗ ls -ltrh / Users / thefourtheye / git / libuv / out / Debug / run-tests
-rwxr-xr-x 1 thefoutheye 110095815 1.1 M 29 Nov 17 17:32 / Users / thefourtheye / git / libuv / out / Debug / run-tests

The details of my operating system

➜ libuv git: (v1.x) ✗ sw_vers
Product Name: Mac OS X
Product Version: 10.12.6
BuildVersion: 16G1618

My questions are

  1. Why the $ {SFW} --add says the app is added and $ {SFW} --unblock says the application is not part of the firewall?
  2. How can I fix this?