X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fc4b0d44a9da64f74e4df9f56d8f1d5dd3a2bad4..89d98a56977c70b61c8dba09f5c5136e73784339:/tools/tesh/run_context.c diff --git a/tools/tesh/run_context.c b/tools/tesh/run_context.c index f58c80edc9..b31a3fce9c 100644 --- a/tools/tesh/run_context.c +++ b/tools/tesh/run_context.c @@ -85,7 +85,7 @@ void rctx_init(void) sigwaiter_mutex = xbt_os_mutex_init(); sigwaiter_cond = xbt_os_cond_init(); xbt_os_mutex_acquire(sigwaiter_mutex); - sigwaiter_thread = xbt_os_thread_create("Armaggedon request waiter", + sigwaiter_thread = xbt_os_thread_create("Armageddon request waiter", armageddon_sigwaiter, NULL, NULL); /* Wait for thread to start... */ xbt_os_cond_wait(sigwaiter_cond, sigwaiter_mutex); @@ -742,7 +742,7 @@ void *rctx_wait(void *r) return NULL; xbt_os_mutex_acquire(rctx->interruption); */ - { + { // Sorting output got xbt_dynar_t a = xbt_str_split(rctx->output_got->data, "\n"); xbt_dynar_t b = xbt_dynar_new(sizeof(char *), NULL); unsigned cpt; @@ -777,6 +777,22 @@ void *rctx_wait(void *r) xbt_dynar_free(&a); } + if (rctx->output_sort) { // Sorting output wanted + char *newbuf; + xbt_dynar_t a = xbt_str_split(rctx->output_wanted->data, "\n"); + + stable_sort(a); + /* If empty lines moved in first position, remove them */ + while (!xbt_dynar_is_empty(a) && *xbt_dynar_getfirst_as(a, char*) == '\0') + xbt_dynar_shift(a, NULL); + + newbuf = xbt_str_join(a, "\n"); + strcpy(rctx->output_wanted->data, newbuf); + rctx->output_wanted->used = strlen(newbuf); + xbt_free(newbuf); + + xbt_dynar_free(&a); + } xbt_strbuff_chomp(rctx->output_got); xbt_strbuff_chomp(rctx->output_wanted); xbt_strbuff_trim(rctx->output_got);