MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / test_real_chip_query_task

Function test_real_chip_query_task

test/Core/QPilotOSMachine.test.cpp:545–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543}
544
545static bool test_real_chip_query_task(QPilotOSMachine& qvm, const CaseConf &conf)
546{
547 PilotQVM::PilotTaskQueryResult res;
548 std::string compile_prog;
549 bool with_compensate = true;
550 for (size_t test_cnt = 0; test_cnt < 1/*0000*/; ++test_cnt)
551 {
552 do
553 {
554 qvm.query_task_state(Task_Id, res);
555 if (res.m_errCode != 0) {
556 std::cout << "Query error!" << std::endl << "errCode: " << res.m_errCode << std::endl << "errInfo: " << res.m_errInfo << std::endl;
557 return false;
558 }
559 std::this_thread::sleep_for(std::chrono::seconds(1));
560 std::cout << ".";
561 } while ((res.m_state != SUCCESS_STATE) && (res.m_state != FAILED_STATE) && (res.m_state != CANCELED_STATE));
562
563 std::vector<std::map<std::string, double>> result;
564 qvm.parse_task_result(res.m_result_vec, result);
565 std::cout << "\nGot result:\n";
566 for (auto res1 : result)
567 {
568 for (const auto& val : res1) {
569 cout << val.first << ": " << val.second << "\n";
570 }
571 }
572 }
573
574 return true;
575}
576
577static bool test_real_chip_query_compile_info(QPilotOSMachine& qvm)
578{

Callers

nothing calls this directly

Calls 2

query_task_stateMethod · 0.45
parse_task_resultMethod · 0.45

Tested by

no test coverage detected