Add batch 1 (YosysHQ_picorv32, alexforencich_verilog-ethernet, The-OpenROAD-Project_OpenROAD, darklife_darkriscv, corundum_corundum)
f61bac1 verified Download The-OpenROAD-Project_OpenROAD/src/dst/test/cpp/TestWorker.cc from SAIFIINDUSTRIES/verilog_data-1: direct link, hf CLI and curl.
- Browser
- Download file 2.35 kB
-
https://huggingface.co/datasets/SAIFIINDUSTRIES/verilog_data-1/resolve/main/The-OpenROAD-Project_OpenROAD/src/dst/test/cpp/TestWorker.cc
- Command line
-
hf download hf://datasets/SAIFIINDUSTRIES/verilog_data-1/The-OpenROAD-Project_OpenROAD/src/dst/test/cpp/TestWorker.cc
-
curl -L -o TestWorker.cc https://huggingface.co/datasets/SAIFIINDUSTRIES/verilog_data-1/resolve/main/The-OpenROAD-Project_OpenROAD/src/dst/test/cpp/TestWorker.cc
2.35 kB
| namespace dst { | |
| namespace { | |
| bool isSocketPermissionError(const boost::system::system_error& error) | |
| { | |
| return error.code() | |
| == boost::system::errc::make_error_code( | |
| boost::system::errc::operation_not_permitted) | |
| || error.code() | |
| == boost::system::errc::make_error_code( | |
| boost::system::errc::permission_denied); | |
| } | |
| bool isSocketStartupRuntimeError(const std::runtime_error& error) | |
| { | |
| const std::string message = error.what(); | |
| return message.starts_with("DST-0001"); | |
| } | |
| bool isSocketEnvironmentErrorMessage(const std::string& message) | |
| { | |
| return message.find("Operation not permitted") != std::string::npos | |
| || message.find("Permission denied") != std::string::npos | |
| || message.find("DST-0001") != std::string::npos; | |
| } | |
| } // namespace | |
| TEST(test_suite, test_worker) | |
| { | |
| try { | |
| utl::Logger* logger = new utl::Logger(); | |
| Distributed* dist = new Distributed(logger); | |
| std::string local_ip = "127.0.0.1"; | |
| unsigned short port = 1234; | |
| Worker* worker = new Worker(dist, logger, local_ip.c_str(), port); | |
| boost::thread t(boost::bind(&Worker::run, worker)); | |
| // Checking if the worker is up and calling callbacks correctly | |
| dist->addCallBack(new HelperCallBack(dist)); | |
| JobMessage msg(JobMessage::JobType::kRouting); | |
| JobMessage result; | |
| EXPECT_TRUE(dist->sendJob(msg, local_ip.c_str(), port, result)); | |
| EXPECT_EQ(result.getJobType(), JobMessage::JobType::kSuccess); | |
| } catch (const boost::system::system_error& error) { | |
| if (isSocketPermissionError(error)) { | |
| GTEST_SKIP() << error.what(); | |
| } | |
| throw; | |
| } catch (const std::runtime_error& error) { | |
| if (isSocketStartupRuntimeError(error)) { | |
| GTEST_SKIP() << error.what(); | |
| } | |
| throw; | |
| } catch (const std::exception& error) { | |
| if (isSocketEnvironmentErrorMessage(error.what())) { | |
| GTEST_SKIP() << error.what(); | |
| } | |
| throw; | |
| } | |
| } | |
| } // namespace dst | |