#define _LGPL_SOURCE
#include <ctype.h>
#include <popt.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int argc, const char **argv, const char *help_msg)
{
int opt, ret = 0, success = 1;
+ bool opt_all_present = false;
enum cmd_error_code command_ret = CMD_SUCCESS;
static poptContext pc;
char *session_name = NULL;
type_state = STATE_VGID;
break;
case OPT_ALL:
- switch (type_state) {
- case STATE_PID:
- opt_pid.all = 1;
- break;
- case STATE_VPID:
- opt_vpid.all = 1;
- break;
- case STATE_UID:
- opt_uid.all = 1;
- break;
- case STATE_VUID:
- opt_vuid.all = 1;
- break;
- case STATE_GID:
- opt_gid.all = 1;
- break;
- case STATE_VGID:
- opt_vgid.all = 1;
- break;
- default:
- command_ret = CMD_ERROR;
- goto end;
- }
+ opt_all_present = true;
break;
default:
command_ret = CMD_UNDEFINED;
goto end;
}
+ /*
+ * If the `--all` option is present set the appropriate tracker's `all`
+ * field.
+ */
+ if (opt_all_present) {
+ switch (type_state) {
+ case STATE_PID:
+ opt_pid.all = 1;
+ break;
+ case STATE_VPID:
+ opt_vpid.all = 1;
+ break;
+ case STATE_UID:
+ opt_uid.all = 1;
+ break;
+ case STATE_VUID:
+ opt_vuid.all = 1;
+ break;
+ case STATE_GID:
+ opt_gid.all = 1;
+ break;
+ case STATE_VGID:
+ opt_vgid.all = 1;
+ break;
+ default:
+ command_ret = CMD_ERROR;
+ goto end;
+ }
+ }
+
if (!opt_session_name) {
session_name = get_session_name();
if (session_name == NULL) {
SESSION_NAME="tracker"
NR_ITER=100
NUM_GLOBAL_TESTS=2
-NUM_UST_TESTS=265
+NUM_UST_TESTS=283
NUM_KERNEL_TESTS=462
NUM_TESTS=$((NUM_UST_TESTS+NUM_KERNEL_TESTS+NUM_GLOBAL_TESTS))
EVENT_NAME="tp:tptest"
+# Both ordering of tracker type and `--all` are valid.
+test_event_track_untrack ust 0 "${EVENT_NAME}" "--vgid --all"
+test_event_track_untrack ust 0 "${EVENT_NAME}" "--all --vgid"
+
#vuid, vgid
# non-matching