twister

HTTP fault injector for testing
Log | Files | Refs | README | LICENSE

commit 5b9947e19fd9f53f6dbdc0b2f519ce96468b0386
parent a28e9e0d84bff40994151e6e5a3410c047b1e4bf
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Tue, 15 May 2018 11:46:31 +0200

Differentiate between bit-flipping in download and upload.

Diffstat:
Msrc/twister/taler-twister-service.c | 11++++++++++-
Msrc/twister/taler-twister.c | 30+++++++++++++++++++++++-------
Msrc/twister/twister.h | 4+++-
Msrc/twister/twister_api.c | 2+-
4 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/src/twister/taler-twister-service.c b/src/twister/taler-twister-service.c @@ -1237,6 +1237,15 @@ create_response (void *cls, * generate curl request to the proxied service. */ if (NULL == hr->curl) { + #if 0 + if (GNUNET_YES == flip_upload) + { + /* */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Going to modify the upload object\n"), + } + #endif + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Generating curl request\n"); hr->curl = curl_easy_init (); @@ -2044,7 +2053,7 @@ GNUNET_SERVICE_MAIN NULL), GNUNET_MQ_hd_fixed_size (flip_path, - TWISTER_MESSAGE_TYPE_FLIP_PATH, + TWISTER_MESSAGE_TYPE_FLIP_PATH_DL, struct TWISTER_FlipPath, NULL), diff --git a/src/twister/taler-twister.c b/src/twister/taler-twister.c @@ -65,7 +65,9 @@ static int malform_upload; /** * Path to the string json object to flip. */ -static char *flip_path; +static char *flip_path_dl; + +static char *flip_path_ul; /** * Path to the object to modify. @@ -178,12 +180,18 @@ run (void *cls, NULL)) ) num_ops++; - /* TODO: add other operations here */ + if ( (NULL != flip_path_ul) && + (NULL != TALER_TWISTER_flip_path + (tth, + flip_path_ul, + &handle_acknowledgement, + NULL)) ) + num_ops++; - if ( (NULL != flip_path) && + if ( (NULL != flip_path_dl) && (NULL != TALER_TWISTER_flip_path (tth, - flip_path, + flip_path_dl, &handle_acknowledgement, NULL)) ) num_ops++; @@ -243,12 +251,20 @@ main (int argc, &modify_path), GNUNET_GETOPT_option_string + ('F', + "flip-ul", + "PATH", + gettext_noop + ("Flip a char in the _string_ upload object pointed by PATH.\n"), + &flip_path_ul), + + GNUNET_GETOPT_option_string ('f', - "flip", + "flip-dl", "PATH", gettext_noop - ("Flip a char in the _string_ object pointed by PATH.\n"), - &flip_path), + ("Flip a char in the _string_ download object pointed by PATH.\n"), + &flip_path_dl), GNUNET_GETOPT_option_string ('V', diff --git a/src/twister/twister.h b/src/twister/twister.h @@ -51,7 +51,9 @@ #define TWISTER_MESSAGE_TYPE_MALFORM_UPLOAD 6 -#define TWISTER_MESSAGE_TYPE_FLIP_PATH 7 +#define TWISTER_MESSAGE_TYPE_FLIP_PATH_DL 7 + +#define TWISTER_MESSAGE_TYPE_FLIP_PATH_UL 8 GNUNET_NETWORK_STRUCT_BEGIN struct TWISTER_Malform diff --git a/src/twister/twister_api.c b/src/twister/twister_api.c @@ -306,7 +306,7 @@ TALER_TWISTER_flip_path op); /* Prepare *env*elope. */ env = GNUNET_MQ_msg - (src, TWISTER_MESSAGE_TYPE_FLIP_PATH); + (src, TWISTER_MESSAGE_TYPE_FLIP_PATH_DL); /* Put data into the envelope. */ strcpy (src->path, path); /* Send message. */