summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMykola Ostrovskyy <mykola@ti.com>2012-02-16 16:47:20 +0200
committerDaniel Levin <dendy@ti.com>2012-07-25 08:55:44 -0500
commit69b892f1b910e1647e2e95ab1183f63679cbab02 (patch)
tree94d6c73c1375903f4bd361d7eb58087bdc6a64a6 /test
parent517922a4142a116fe70820362e010e9d85881ca8 (diff)
downloadhardware_ti_omap4-69b892f1b910e1647e2e95ab1183f63679cbab02.zip
hardware_ti_omap4-69b892f1b910e1647e2e95ab1183f63679cbab02.tar.gz
hardware_ti_omap4-69b892f1b910e1647e2e95ab1183f63679cbab02.tar.bz2
CameraHAL: Control logcat recording from command line
Saving of any logs can be disabled. This is useful when framework that runs camera_test takes care of logs capture in some alternative way (e.g. 'adb logcat' command from the host). Change-Id: I00eb806afc930e58146dacd5966a0af93eeb1cf8 Signed-off-by: Mykola Ostrovskyy <mykola@ti.com>
Diffstat (limited to 'test')
-rw-r--r--test/CameraHal/camera_test.h8
-rw-r--r--test/CameraHal/camera_test_menu.cpp13
-rw-r--r--test/CameraHal/camera_test_script.cpp38
3 files changed, 32 insertions, 27 deletions
diff --git a/test/CameraHal/camera_test.h b/test/CameraHal/camera_test.h
index 2c7f585..5a634c6 100644
--- a/test/CameraHal/camera_test.h
+++ b/test/CameraHal/camera_test.h
@@ -92,7 +92,7 @@ enum logging {
typedef struct cmd_args {
test_type_t test_type;
- char *script_file_name;
+ const char *script_file_name;
int platform_id;
int logging;
} cmd_args_t;
@@ -172,9 +172,9 @@ int closeRecorder();
int openRecorder();
int configureRecorder();
void printSupportedParams();
-char *load_script(char *config);
-int start_logging(char *config, int &pid);
-int stop_logging(int &pid);
+char *load_script(const char *config);
+int start_logging(const char *config, int flags, int &pid);
+int stop_logging(int flags, int &pid);
int execute_error_script(char *script);
int getParametersFromCapabilities();
void getSizeParametersFromCapabilities();
diff --git a/test/CameraHal/camera_test_menu.cpp b/test/CameraHal/camera_test_menu.cpp
index 3f3e3f1..b142f6e 100644
--- a/test/CameraHal/camera_test_menu.cpp
+++ b/test/CameraHal/camera_test_menu.cpp
@@ -429,7 +429,6 @@ const char *metering[] = {
"average",
};
int meter_mode = 0;
-bool bLogSysLinkTrace = true;
bool stressTest = false;
bool stopScript = false;
int restartCount = 0;
@@ -3287,10 +3286,6 @@ int runRegressionTest(cmd_args_t *cmd_args) {
char *cmd;
int pid;
- if ((cmd_args->logging & LOGGING_SYSLINK) == 0) {
- bLogSysLinkTrace = false;
- }
-
platformID = cmd_args->platform_id;
int res = startTest();
@@ -3301,7 +3296,7 @@ int runRegressionTest(cmd_args_t *cmd_args) {
cmd = load_script(cmd_args->script_file_name);
if (cmd != NULL) {
- start_logging(cmd_args->script_file_name, pid);
+ start_logging(cmd_args->script_file_name, cmd_args->logging, pid);
stressTest = true;
while (1) {
@@ -3321,7 +3316,7 @@ int runRegressionTest(cmd_args_t *cmd_args) {
}
free(cmd);
- stop_logging(pid);
+ stop_logging(cmd_args->logging, pid);
}
return 0;
@@ -3362,10 +3357,10 @@ int runErrorTest(cmd_args_t *cmd_args) {
cmd = load_script(cmd_args->script_file_name);
if (cmd != NULL) {
- start_logging(cmd_args->script_file_name, pid);
+ start_logging(cmd_args->script_file_name, cmd_args->logging, pid);
execute_error_script(cmd);
free(cmd);
- stop_logging(pid);
+ stop_logging(cmd_args->logging, pid);
}
} else {
print_menu = 1;
diff --git a/test/CameraHal/camera_test_script.cpp b/test/CameraHal/camera_test_script.cpp
index 71eae57..737f6bf 100644
--- a/test/CameraHal/camera_test_script.cpp
+++ b/test/CameraHal/camera_test_script.cpp
@@ -132,7 +132,6 @@ extern const int ManualConvergenceDefaultValue;
extern size_t length_cam;
extern char script_name[];
extern int restartCount;
-extern bool bLogSysLinkTrace;
extern int bufferStarvationTest;
extern size_t length_previewSize;
extern size_t length_thumbnailSize;
@@ -1285,7 +1284,7 @@ status_t dump_mem_status() {
return system(MEMORY_DUMP);
}
-char *load_script(char *config) {
+char *load_script(const char *config) {
FILE *infile;
size_t fileSize;
char *script;
@@ -1358,11 +1357,16 @@ char *load_script(char *config) {
return script;
}
-int start_logging(char *config, int &pid) {
+int start_logging(const char *config, int flags, int &pid) {
char dir_name[40];
size_t count = 0;
int status = 0;
+ if (flags == 0) {
+ pid = -1;
+ return 0;
+ }
+
// remove just the '.txt' part of the config
while((config[count] != '.') && (count < sizeof(dir_name)/sizeof(dir_name[0])))
count++;
@@ -1385,11 +1389,13 @@ int start_logging(char *config, int &pid) {
setpgid(getpid(), getpid());
/* Start logcat */
- if(!sprintf(log_cmd,"logcat > /sdcard/%s/log.txt &",dir_name))
- printf(" Sprintf Error");
+ if (flags & LOGGING_LOGCAT) {
+ if(!sprintf(log_cmd,"logcat > /sdcard/%s/log.txt &",dir_name))
+ printf(" Sprintf Error");
+ }
/* Start Syslink Trace */
- if(bLogSysLinkTrace) {
+ if (flags & LOGGING_SYSLINK) {
if(!sprintf(log_cmd,"%s /system/bin/syslink_trace_daemon.out -l /sdcard/%s/syslink_trace.txt -f &",log_cmd, dir_name))
printf(" Sprintf Error");
}
@@ -1413,18 +1419,22 @@ int start_logging(char *config, int &pid) {
return 0;
}
-int stop_logging(int &pid)
+int stop_logging(int flags, int &pid)
{
- if(pid > 0)
- {
- if(killpg(pid, SIGKILL))
- {
+ if (pid > 0) {
+ if (killpg(pid, SIGKILL)) {
printf("Exit command failed");
return -1;
} else {
- printf("\nlogging for script %s is complete\n logcat saved @ location: %s\n",script_name,dir_path);
- if (bLogSysLinkTrace)
- printf(" syslink_trace is saved @ location: %s\n\n",dir_path);
+ printf("\nlogging for script %s is complete\n", script_name);
+
+ if (flags & LOGGING_LOGCAT) {
+ printf(" logcat saved @ location: %s\n", dir_path);
+ }
+
+ if (flags & LOGGING_SYSLINK) {
+ printf(" syslink_trace is saved @ location: %s\n\n", dir_path);
+ }
}
}
return 0;