summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjolsa@redhat.com <jolsa@redhat.com>2011-08-15 18:57:08 +0200
committerJiri Olsa <Jiri Olsa jolsa@redhat.com>2011-11-24 21:20:27 +0100
commita7fcfb0f70301b09cea3ba59338aaa5a01bbefcb (patch)
treedc025520578a45eb5d79e38e47b5027d3a0a3d8b
parentd4d4ddd698f1378649e33aa58b7e3b687a2e6c3d (diff)
downloadlatrace-a7fcfb0f70301b09cea3ba59338aaa5a01bbefcb.tar.gz
latrace-a7fcfb0f70301b09cea3ba59338aaa5a01bbefcb.tar.xz
latrace-a7fcfb0f70301b09cea3ba59338aaa5a01bbefcb.zip
error simulation: allow to omit trace/tty/stat storage
-rw-r--r--src/config-bison.y1
-rw-r--r--src/error.c43
-rw-r--r--src/error.h1
3 files changed, 29 insertions, 16 deletions
diff --git a/src/config-bison.y b/src/config-bison.y
index 14ee5a3..0e6b3ef 100644
--- a/src/config-bison.y
+++ b/src/config-bison.y
@@ -313,6 +313,7 @@ error_def error_return
error_def ERR_DIR NAME
{
error_app.dir = strdup($3);
+ error_app.no_storage = 0;
}
|
error_def ERR_PROG NAME
diff --git a/src/error.c b/src/error.c
index 68cf302..7d1a418 100644
--- a/src/error.c
+++ b/src/error.c
@@ -15,8 +15,7 @@ int lt_error_app(struct lt_config_app *cfg, struct lt_error_app *error_app)
struct lt_error_app_go *go, *g;
struct lt_error_app_run *run, *r;
- if (!error_app->prog ||
- !error_app->dir)
+ if (!error_app->prog)
return -EINVAL;
app = malloc(sizeof(*app));
@@ -317,14 +316,16 @@ static int prepare_config(struct lt_config_app *cfg, char *dir,
{
PRINT_VERBOSE(cfg, 1, "dir '%s'\n", dir);
- if (prepare_config_trace(cfg, dir))
- return -1;
+ if (!app->no_storage) {
+ if (prepare_config_trace(cfg, dir))
+ return -1;
- if (prepare_config_stat(cfg, dir))
- return -1;
+ if (prepare_config_stat(cfg, dir))
+ return -1;
- if (prepare_config_tty(cfg, dir))
- return -1;
+ if (prepare_config_tty(cfg, dir))
+ return -1;
+ }
if (prepare_config_args(cfg, app, run))
return -1;
@@ -335,12 +336,15 @@ static int prepare_config(struct lt_config_app *cfg, char *dir,
return 0;
}
-static void post_config(struct lt_config_app *cfg)
+static void post_config(struct lt_config_app *cfg,
+ struct lt_error_app *app)
{
- if ((lt_sh(cfg, pipe)) && (*lt_sh(cfg, output)))
- fclose(lt_sh(cfg, fout));
+ if (!app->no_storage) {
+ if ((lt_sh(cfg, pipe)) && (*lt_sh(cfg, output)))
+ fclose(lt_sh(cfg, fout));
- fclose(cfg->fstat);
+ fclose(cfg->fstat);
+ }
}
static int process_run(struct lt_config_app *cfg,
@@ -352,7 +356,8 @@ static int process_run(struct lt_config_app *cfg,
{
static char dir[LT_MAXFILE];
- if (dir_run(cfg, dir, dir_base, run, n))
+ if (!app->no_storage &&
+ dir_run(cfg, dir, dir_base, run, n))
return -1;
PRINT_VERBOSE(cfg, 1, "dir '%s'\n", dir);
@@ -360,9 +365,12 @@ static int process_run(struct lt_config_app *cfg,
if (prepare_config(cfg, dir, app, run, n))
return -1;
+ if (app->no_storage)
+ printf("latrace error simulation [%s] n = %d\n", app->name, n);
+
lt_run(cfg);
- post_config(cfg);
+ post_config(cfg, app);
return 0;
}
@@ -374,7 +382,8 @@ static int process_go(struct lt_config_app *cfg, char *dir_base,
static char dir[LT_MAXFILE];
int i;
- if (dir_go(cfg, dir, dir_base, go))
+ if (!app->no_storage &&
+ dir_go(cfg, dir, dir_base, go))
return -1;
PRINT_VERBOSE(cfg, 1, "dir '%s'\n", dir);
@@ -398,7 +407,8 @@ int lt_error_run(struct lt_config_app *cfg)
printf("latrace error simulation [%s]\n", app->name);
- if (dir_base(cfg, app, dir))
+ if (!app->no_storage &&
+ dir_base(cfg, app, dir))
return -1;
PRINT_VERBOSE(cfg, 1, "dir '%s'\n", dir);
@@ -656,5 +666,6 @@ int lt_error_app_init(struct lt_error_app *app)
lt_init_list_head(&app->head_go);
lt_init_list_head(&app->head_return);
lt_init_list_head(&app->list);
+ app->no_storage = 1;
return 0;
}
diff --git a/src/error.h b/src/error.h
index 5c44633..042d594 100644
--- a/src/error.h
+++ b/src/error.h
@@ -83,6 +83,7 @@ struct lt_error_app_go {
struct lt_error_app {
char *name;
char *dir;
+ int no_storage;
char *prog;
struct lt_list_head head_run;