tests/random spawns itself to test running the program with various options.
The test/random is built by libtool (with -no-install option) and it uses DYLD_LIBRARY_PATH to allow running a program without installing libgcrypt library.
Unfortunately, with SIP (System Integrity Protection) interferes this running tests/random.
tests/random uses system(3) to spawn processes; But because it uses /bin/sh, the environment variable DYLD_LIBRARY_PATH is purged.