MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / TestOtherProcess

Function TestOtherProcess

src/test/util_tests.cpp:1088–1113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1086static constexpr char ExitCommand = 'X';
1087
1088static void TestOtherProcess(fs::path dirname, std::string lockname, int fd)
1089{
1090 char ch;
1091 while (true) {
1092 int rv = read(fd, &ch, 1); // Wait for command
1093 assert(rv == 1);
1094 switch(ch) {
1095 case LockCommand:
1096 ch = LockDirectory(dirname, lockname);
1097 rv = write(fd, &ch, 1);
1098 assert(rv == 1);
1099 break;
1100 case UnlockCommand:
1101 ReleaseDirectoryLocks();
1102 ch = true; // Always succeeds
1103 rv = write(fd, &ch, 1);
1104 assert(rv == 1);
1105 break;
1106 case ExitCommand:
1107 close(fd);
1108 exit(0);
1109 default:
1110 assert(0);
1111 }
1112 }
1113}
1114#endif
1115
1116BOOST_AUTO_TEST_CASE(test_LockDirectory)

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 2

LockDirectoryFunction · 0.85
ReleaseDirectoryLocksFunction · 0.85

Tested by

no test coverage detected