use gcov to measure the code coverage and return the measured data back
to the host
Change-Id: Ia9393ccb8dd3f3321f545abb9d20a6d37de5765f
diff --git a/agents/hal/HalAgentMain.cpp b/agents/hal/HalAgentMain.cpp
index 384a2a8..bd0f57e 100644
--- a/agents/hal/HalAgentMain.cpp
+++ b/agents/hal/HalAgentMain.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <unistd.h>
+
#include <iostream>
#include "TcpServer.h"
@@ -37,7 +39,21 @@
<< "[<fuzzer binary path> [<spec file base dir path>]]" << std::endl;
return -1;
}
+
+ char* dir_path;
+ dir_path = (char*) malloc(strlen(argv[0]) + 1);
+ strcpy(dir_path, argv[0]);
+ for (int index = strlen(argv[0]) - 2; index >= 0; index--) {
+ if (dir_path[index] == '/') {
+ dir_path[index] = '\0';
+ break;
+ }
+ }
+ printf("chdir %s\n", dir_path);
+ chdir(dir_path);
+
android::vts::StartTcpServer(
(const char*) fuzzer_path, (const char*) spec_dir_path);
+
return 0;
}