From: Shao-Feng Date: Wed, 6 Nov 2013 09:01:33 +0000 (+0800) Subject: Upgrade to v2.3 X-Git-Tag: upstream/1.0~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0224f0d70f3351f9c3c9aeae372808d26744f52;p=test%2Ftools%2Ftestkit-stub.git Upgrade to v2.3 --- diff --git a/README b/README new file mode 100644 index 0000000..55f985c --- /dev/null +++ b/README @@ -0,0 +1 @@ +place holder diff --git a/README.md b/README.md deleted file mode 100644 index dccd626..0000000 --- a/README.md +++ /dev/null @@ -1,24 +0,0 @@ -TCT-stub -======== - -Intel Tizen Compatibility Test Stub - -to build and install x86 version on host pc, -1, make - -2, sudo make install - - - -to build ARM version locally(without OBS), please make sure - -1, install tizen2.0 SDK with all component selected, - -2, replace all "/home/danny/" in build_data to your own home path, such as "/home/wl/" - -3, run native-make -t device in CommandLineBuild folder. - - -to build unit test, just run "make ut" in root folder of the project. then run valgrind to check memory leak. - -valgrind --tool=memcheck --leak-check=yes --track-origins=yes -v ./ut \ No newline at end of file diff --git a/makefile b/makefile index 97e7be0..08d5a3c 100644 --- a/makefile +++ b/makefile @@ -65,10 +65,11 @@ clean: rm -f $(UT_TARGET) install: $(TARGET) + #cp $(TARGET) $(PREFIX_BIN) install -d $(DESTDIR)/usr/bin/ install -m 755 $(TARGET) $(DESTDIR)/usr/bin/ uninstall: - rm /usr/bin/$(TARGET) + rm -f $(PREFIX_BIN)/$(TARGET) rebuild: clean compile diff --git a/packaging/testkit-stub.debug.spec b/packaging/testkit-stub.debug.spec index fa49a6f..59897cd 100644 --- a/packaging/testkit-stub.debug.spec +++ b/packaging/testkit-stub.debug.spec @@ -1,7 +1,7 @@ Name: testkit-stub Summary: test -Version: 1.0 +Version: 1.3 Release: 1 Group: Development/Debug License: GPL v2 only diff --git a/packaging/testkit-stub.spec b/packaging/testkit-stub.spec index 6569f72..9de3311 100644 --- a/packaging/testkit-stub.spec +++ b/packaging/testkit-stub.spec @@ -1,7 +1,7 @@ Name: testkit-stub Summary: test -Version: 1.0 +Version: 1.3 Release: 1 Group: Development/Debug License: GPL v2 only diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 7bca8b6..544202a 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -243,7 +243,7 @@ a typical workflow of manual case would be **/ void HttpServer::processpost(int s, struct HttpRequest *prequest) { prequest->prefix = "application/json"; - string json_str = "{\"OK\":1}"; + string json_str = ""; if (prequest->path.find("/init_test") != string::npos) {// invoke by com-module to init some para for test Json::Reader reader; @@ -274,13 +274,15 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { //wait for the index window.close, otherwise will occur bind aleady error sleep(1); } + + json_str = "{\"OK\":1}"; } else { cout << "error while parse para from com-module, can't start test" << endl; cout << prequest->content; DBG_ONLY(outputFile << "error while parse para from com-module, can't start test" << endl;); DBG_ONLY(outputFile << prequest->content;); - json_str = "{\"Error\":\"parse error\"}"; + json_str = "{\"Error\":1}"; } } else if (prequest->path.find("/set_testcase") != string::npos) {// invoke by com-module to send testcase data m_block_finished = false; @@ -299,6 +301,8 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { m_block_case_index = 0; if (m_current_block_index == 1) m_total_case_index = 0; + + json_str = "{\"OK\":1}"; } else if (prequest->path == "/check_server") {// invoke by index.html to find server running or not m_server_checked = true; m_check_times = 0; @@ -306,6 +310,7 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { cout << "[ checking server, and found the server is running ]" << endl; DBG_ONLY(outputFile << "[ checking server, and found the server is running ]" << endl;); + json_str = "{\"OK\":1}"; } else if (prequest->path == "/check_server_status") {// invoke by com-module to get server status Json::Value status; status["block_finished"] = m_block_finished ? 1 : 0; @@ -332,8 +337,10 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { } else if (prequest->path == "/shut_down_server") { if (g_run_wiget == true) killAllWidget(); // kill all widget when shutdown server + json_str = "{\"OK\":1}"; gIsRun = 0; } else if (prequest->path.find("/init_session_id") != string::npos) {// invoke by index.html to record a session id + json_str = "{\"OK\":1}"; int index = prequest->path.find('='); if (index != -1) { m_running_session = prequest->path.substr(index + 1); @@ -359,7 +366,7 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { string error_type = ""; bool find_tc = get_auto_case(prequest->content, &error_type); if (find_tc == false) { - json_str = "{\"" + error_type + "\":0}"; + json_str = "{\"" + error_type + "\":1}";// {none:0} will not work sometime } else { json_str = m_test_cases[m_block_case_index].to_json().toStyledString(); } @@ -401,6 +408,7 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { json_str = "{\"Error\":\"no manual result\"}"; } else { find_purpose(splitContent(prequest->content), false); // will set index in find_purpose + json_str = "{\"OK\":1}"; } } else if (prequest->path.find("/check_execution_progress") != string::npos) {//invoke by index.html to get test result of last auto case char *total_count = new char[16]; @@ -422,6 +430,8 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { m_block_finished = true; if (m_current_block_index == m_totalBlocks) m_set_finished = true; + + json_str = "{\"OK\":1}"; } //from com module,when m_set_finished is true else if (prequest->path == "/get_test_result") { @@ -460,12 +470,16 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { } find_purpose(paras, true); + + json_str = "{\"OK\":1}"; } } } else if (prequest->path == "/set_capability") {// by com-module to send capability data Json::Reader reader; reader.parse(prequest->content, m_capability); + + json_str = "{\"OK\":1}"; } else if (prequest->path.find("/capability") != string::npos) {// by test suite. only one query parameter each time json_str = "{\"support\":0}"; @@ -488,7 +502,6 @@ void HttpServer::processpost(int s, struct HttpRequest *prequest) { } } else { cout << "=================unknown request: " << prequest->path << endl; - json_str = "{\"Error\":\"unknown request\"}"; } DBG_ONLY( @@ -718,8 +731,8 @@ void HttpServer::StartUp() { return; } gIsRun = 1; - cout << "[ Server is running.....]" << endl; - DBG_ONLY(outputFile << "[ Server is running.....]" << endl;); + cout << "[Server is running.....]" << endl; + DBG_ONLY(outputFile << "[Server is running.....]" << endl;); while (gIsRun) { clientsocket = accept(serversocket, (struct sockaddr *) &clientAddr,