X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/06bae8eb4bc956a5ee70ec1d3cdbc5e7e782536f..9a4f8255848ed4b9ccfd54d1d635de698889d86c:/tools/tesh/tesh.c diff --git a/tools/tesh/tesh.c b/tools/tesh/tesh.c index f865e45fb4..7f752291ac 100644 --- a/tools/tesh/tesh.c +++ b/tools/tesh/tesh.c @@ -1,6 +1,6 @@ /* TESH (Test Shell) -- mini shell specialized in running test units */ -/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team. +/* Copyright (c) 2007-2013. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -11,8 +11,6 @@ #pragma hdrstop #endif -#include "simgrid_config.h" //For getline, keep that include first - #include "tesh.h" #include "xbt.h" @@ -22,7 +20,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(tesh, "TEst SHell utility"); int timeout_value = 5; /* child timeout value */ int sort_len = 19; /* length of the prefix to sort */ char *option; -int coverage = 0; /* whether the code coverage is enable */ +int coverage = 0; /* whether the code coverage is enable */ rctx_t rctx; const char *testsuite_name; @@ -106,7 +104,7 @@ static void handle_suite(const char *filename, FILE * IN) buff = xbt_strbuff_new(); rctx = rctx_new(); - while (getline(&line, &len, IN) != -1) { + while (xbt_getline(&line, &len, IN) != -1) { line_num++; /* Count the line length while checking wheather it's blank */ @@ -143,7 +141,6 @@ static void handle_suite(const char *filename, FILE * IN) } else { to_be_continued = 1; line[linelen - 2] = '\0'; - linelen -= 2; if (!buff->used) buffbegin = line_num; } @@ -199,6 +196,8 @@ int main(int argc, char *argv[]) int i; char *suitename = NULL; struct sigaction newact; + + XBT_LOG_CONNECT(tesh); xbt_init(&argc, argv); rctx_init(); parse_environ(); @@ -246,7 +245,7 @@ int main(int argc, char *argv[]) exit(1); } if (!option){ //if option is NULL - option = bprintf("--cfg=%s",argv[i+1]); + option = bprintf("--cfg=%s",argv[i+1]); } else { char *newoption = bprintf("%s --cfg=%s", option, argv[i+1]); free(option); @@ -258,11 +257,11 @@ int main(int argc, char *argv[]) i -= 2; } else if (!strcmp(argv[i], "--enable-coverage" )){ - coverage = 1; - XBT_INFO("Enable coverage"); - memmove(argv + i, argv + i + 1, (argc - i - 1) * sizeof(char *)); - argc -= 1; - i -= 1; + coverage = 1; + XBT_INFO("Enable coverage"); + memmove(argv + i, argv + i + 1, (argc - i - 1) * sizeof(char *)); + argc -= 1; + i -= 1; } }