diff options
author | Manoj Srivastava <srivasta@debian.org> | 2016-07-31 15:00:12 -0700 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2016-07-31 15:00:12 -0700 |
commit | dc20a68ba953b2a5da0311f3ce9f9217f9ad60b3 (patch) | |
tree | e45fdd69828a8668029d07f8601442cbb9258559 /tests | |
parent | e68e1da425634fda40095a7b3196d4175f782987 (diff) | |
parent | 487177cbb85bc4e88e468c71b27569054b8df090 (diff) |
Merge branch 'upstream'
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
# Conflicts:
# src/buf.c
# src/flex.skl
# src/skel.c
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 5 | ||||
-rw-r--r-- | tests/bison_nr_parser.y | 2 | ||||
-rw-r--r-- | tests/bison_nr_scanner.l | 2 | ||||
-rw-r--r-- | tests/bison_yylloc_scanner.l | 2 | ||||
-rw-r--r-- | tests/bison_yylval_scanner.l | 2 | ||||
-rw-r--r-- | tests/mem_nr.l | 8 | ||||
-rw-r--r-- | tests/mem_r.l | 8 | ||||
-rw-r--r-- | tests/pthread.l | 2 | ||||
-rw-r--r-- | tests/reject.l4 | 2 | ||||
-rw-r--r-- | tests/string_nr.l | 2 | ||||
-rw-r--r-- | tests/string_r.l | 2 | ||||
-rw-r--r-- | tests/tableopts.l4 | 2 | ||||
-rwxr-xr-x | tests/testwrapper.sh | 10 | ||||
-rw-r--r-- | tests/yyextra.l | 8 |
14 files changed, 29 insertions, 28 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index bdcec1d..de7249b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -37,7 +37,7 @@ LOG_COMPILER = $(srcdir)/testwrapper.sh AM_LOG_FLAGS = -d $(srcdir) -r REJECT_LOG_COMPILER = $(srcdir)/testwrapper.sh -AM_REJECT_LOG_FLAGS = -d $(srcdir) -i reject.txt -r +AM_REJECT_LOG_FLAGS = -d $(srcdir) -i $(srcdir)/reject.txt -r TABLE_LOG_COMPILER = $(srcdir)/testwrapper.sh AM_TABLE_LOG_FLAGS = -d $(builddir) -i $(srcdir)/reject.txt -t @@ -58,6 +58,7 @@ ONE_LOG_COMPILER = $(srcdir)/testwrapper.sh AM_ONE_LOG_FLAGS = -1 -d $(srcdir) AM_YFLAGS = -d -p test +AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS) $(I3_TESTS) $(PTHREAD_TESTS) $(ONE_TESTS) $(TABLEOPTS_TESTS) @@ -438,7 +439,7 @@ tableopts_tests := $(tableopts_opttests) $(tableopts_vertests) $(tableopts_sert tableopts_c := $(addsuffix .c,$(tableopts_tests)) OPT_LOG_COMPILER = $(srcdir)/testwrapper.sh -AM_OPT_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r +AM_OPT_LOG_FLAGS = -d $(srcdir) -i $(srcdir)/tableopts.txt -r tableopts_opt_nr%.c: tableopts.l4 $(FLEX) $(FLEX) -P $(subst -,_,$(basename $(*F))) $* -o $@ $< diff --git a/tests/bison_nr_parser.y b/tests/bison_nr_parser.y index 3021048..cbb4f2c 100644 --- a/tests/bison_nr_parser.y +++ b/tests/bison_nr_parser.y @@ -54,7 +54,7 @@ int process_text(char* s) { %} -%pure_parser +%pure-parser %union { int lineno; diff --git a/tests/bison_nr_scanner.l b/tests/bison_nr_scanner.l index 4378e5a..0bd871c 100644 --- a/tests/bison_nr_scanner.l +++ b/tests/bison_nr_scanner.l @@ -56,7 +56,7 @@ static char* STRDUP(char* s1); static char* STRDUP(char* s1) { - char* s2 = (char*)malloc(strlen(s1)+1); + char* s2 = malloc(strlen(s1)+1); sprintf(s2,"%s",s1); return s2; } diff --git a/tests/bison_yylloc_scanner.l b/tests/bison_yylloc_scanner.l index 3708237..eab898c 100644 --- a/tests/bison_yylloc_scanner.l +++ b/tests/bison_yylloc_scanner.l @@ -59,7 +59,7 @@ static char* STRDUP(char* s1); static char* STRDUP(char* s1) { - char* s2 = (char*)malloc(strlen(s1)+1); + char* s2 = malloc(strlen(s1)+1); sprintf(s2,"%s",s1); return s2; } diff --git a/tests/bison_yylval_scanner.l b/tests/bison_yylval_scanner.l index db99fa0..1e93fc1 100644 --- a/tests/bison_yylval_scanner.l +++ b/tests/bison_yylval_scanner.l @@ -75,7 +75,7 @@ enum yesno_t { no=0, yes=1 }; static char* STRDUP(char* s1) { - char* s2 = (char*)malloc(strlen(s1)+1); + char* s2 = malloc(strlen(s1)+1); sprintf(s2,"%s",s1); return s2; } diff --git a/tests/mem_nr.l b/tests/mem_nr.l index c7a6ce0..f25848f 100644 --- a/tests/mem_nr.l +++ b/tests/mem_nr.l @@ -91,12 +91,12 @@ void * yyalloc(yy_size_t n) int i; total_mem += n; - p = (void*)malloc(n); + p = malloc(n); if( nptrs >= arrsz){ /* increase array size by 1 */ arrsz++; - ptrs = (struct memsz*)realloc( ptrs, arrsz * sizeof(struct memsz)); + ptrs = realloc(ptrs, arrsz * sizeof(struct memsz)); ptrs[nptrs].p = 0; ptrs[nptrs].sz = 0; } @@ -121,7 +121,7 @@ void * yyrealloc(void* p, yy_size_t n) if ( ptrs[i].p == p){ total_mem -= ptrs[i].sz; total_mem += n; - ptrs[i].p = (void*)realloc(p,n); + ptrs[i].p = realloc(p,n); ptrs[i].sz = n; printf("yyflex_realloc(%#10lx,%8ld) total=%8ld return=%8lx\n", @@ -161,7 +161,7 @@ int main () { arrsz = 1; - ptrs = (struct memsz*)calloc(1,sizeof(struct memsz)); + ptrs = calloc(1, sizeof(struct memsz)); nptrs = 0; yyin = stdin; diff --git a/tests/mem_r.l b/tests/mem_r.l index cbfe08c..33b9888 100644 --- a/tests/mem_r.l +++ b/tests/mem_r.l @@ -93,12 +93,12 @@ void * yyalloc(yy_size_t n , void* yyscanner) int i; total_mem += n; - p = (void*)malloc(n); + p = malloc(n); if( nptrs >= arrsz){ /* increase array size by 1 */ arrsz++; - ptrs = (struct memsz*)realloc( ptrs, arrsz * sizeof(struct memsz)); + ptrs = realloc(ptrs, arrsz * sizeof(struct memsz)); ptrs[nptrs].p = 0; ptrs[nptrs].sz = 0; } @@ -125,7 +125,7 @@ void * yyrealloc(void* p, yy_size_t n , void* yyscanner) if ( ptrs[i].p == p){ total_mem -= ptrs[i].sz; total_mem += n; - ptrs[i].p = (void*)realloc(p,n); + ptrs[i].p = realloc(p, n); ptrs[i].sz = n; printf("yyflex_realloc(%#10lx,%8ld) total=%8ld return=%8lx\n", @@ -168,7 +168,7 @@ main () { yyscan_t scanner; arrsz = 1; - ptrs = (struct memsz*)calloc(1,sizeof(struct memsz)); + ptrs = calloc(1, sizeof(struct memsz)); nptrs = 0; yylex_init(&scanner); diff --git a/tests/pthread.l b/tests/pthread.l index 38080c1..c40c024 100644 --- a/tests/pthread.l +++ b/tests/pthread.l @@ -167,7 +167,7 @@ int main (int ARGC, char *ARGV[]) } /* Allocate and initialize the locks. One for each filename in ARGV. */ - file_locks = (pthread_mutex_t*)malloc( (ARGC-1) * sizeof(pthread_mutex_t)); + file_locks = malloc((ARGC-1) * sizeof(pthread_mutex_t)); for( i = 0; i < ARGC-1; i++) pthread_mutex_init( &file_locks[i], NULL ); diff --git a/tests/reject.l4 b/tests/reject.l4 index 27982b1..7eda4a5 100644 --- a/tests/reject.l4 +++ b/tests/reject.l4 @@ -53,7 +53,7 @@ int main ( int argc, char** argv ) #endif #ifdef TEST_HAS_TABLES_EXTERNAL - if((fp = fopen(argv[1],"r"))== NULL) + if((fp = fopen(argv[1],"rb"))== NULL) YY_FATAL_ERROR("could not open tables file for reading"); if(yytables_fload(fp M4_YY_CALL_LAST_ARG) < 0) diff --git a/tests/string_nr.l b/tests/string_nr.l index 3dd752a..e909b2d 100644 --- a/tests/string_nr.l +++ b/tests/string_nr.l @@ -82,7 +82,7 @@ main () We make a copy, since the buffer will be modified by flex.*/ printf("Testing: yy_scan_buffer(%s): ",INPUT_STRING_1); fflush(stdout); len = strlen(INPUT_STRING_1) + 2; - buf = (char*)malloc( len ); + buf = malloc(len); strcpy( buf, INPUT_STRING_1); buf[ len -2 ] = 0; /* Flex requires two NUL bytes at end of buffer. */ buf[ len -1 ] =0; diff --git a/tests/string_r.l b/tests/string_r.l index d98c98a..633004a 100644 --- a/tests/string_r.l +++ b/tests/string_r.l @@ -87,7 +87,7 @@ main () We make a copy, since the buffer will be modified by flex.*/ printf("Testing: yy_scan_buffer(%s): ",INPUT_STRING_1); fflush(stdout); len = strlen(INPUT_STRING_1) + 2; - buf = (char*)malloc( len ); + buf = malloc(len); strcpy( buf, INPUT_STRING_1); buf[ len -2 ] = 0; /* Flex requires two NUL bytes at end of buffer. */ buf[ len -1 ] =0; diff --git a/tests/tableopts.l4 b/tests/tableopts.l4 index bb79407..ac85c29 100644 --- a/tests/tableopts.l4 +++ b/tests/tableopts.l4 @@ -55,7 +55,7 @@ int main ( int argc, char** argv ) #endif #ifdef TEST_HAS_TABLES_EXTERNAL - if((fp = fopen(argv[1],"r"))== NULL) + if((fp = fopen(argv[1],"rb"))== NULL) YY_FATAL_ERROR("could not open tables file for reading"); if(yytables_fload(fp M4_YY_CALL_LAST_ARG) < 0) diff --git a/tests/testwrapper.sh b/tests/testwrapper.sh index 30127b5..051e20b 100755 --- a/tests/testwrapper.sh +++ b/tests/testwrapper.sh @@ -30,10 +30,10 @@ while getopts :d:i:rt1 OPTION ; do TESTNAME="${!OPTIND}" -INPUT_NAME=${INPUT_NAME:-`basename $TESTNAME`.txt} +INPUT_NAME=${INPUT_NAME:-$INPUT_DIRECTORY/`basename $TESTNAME`.txt} if [ "$DO_COMPARISON" -eq "1" ] ; then - test `$TESTNAME 1 < $INPUT_DIRECTORY/$INPUT_NAME` -eq `$TESTNAME < $INPUT_DIRECTORY/$INPUT_NAME` + test `$TESTNAME 1 < $INPUT_NAME` -eq `$TESTNAME < $INPUT_NAME` exit $? fi @@ -42,11 +42,11 @@ if [ $INPUT_COUNT -gt 1 ] ; then exit $? fi -if [ -f ${INPUT_DIRECTORY}/${INPUT_NAME} ] ; then +if [ -f ${INPUT_NAME} ] ; then if [ $USE_REDIRECT == 1 ] ; then - $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} < $INPUT_DIRECTORY/$INPUT_NAME + $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} < $INPUT_NAME else - $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} $INPUT_DIRECTORY/$INPUT_NAME + $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} $INPUT_NAME fi else $TESTNAME diff --git a/tests/yyextra.l b/tests/yyextra.l index 37e8821..8957cbb 100644 --- a/tests/yyextra.l +++ b/tests/yyextra.l @@ -68,11 +68,11 @@ main () struct Buffer * buf; int i; - buf = (struct Buffer*) malloc(sizeof(struct Buffer)); + buf = malloc(sizeof(struct Buffer)); buf->curr_len =0; buf->max_len = 4; buf->grow_len = 100; - buf->data = (char*)malloc(buf->max_len); + buf->data = malloc(buf->max_len); testlex_init(&scanner); testset_in( stdin, scanner); @@ -100,10 +100,10 @@ static void append_char (char c, yyscan_t scanner ) if( buf->curr_len >= buf->max_len ) { - new_buf = (struct Buffer*) malloc(sizeof(struct Buffer)); + new_buf = malloc(sizeof(struct Buffer)); new_buf->max_len = buf->max_len + buf->grow_len; new_buf->grow_len = buf->grow_len; - new_buf->data = (char*)malloc(new_buf->max_len); + new_buf->data = malloc(new_buf->max_len); for( new_buf->curr_len = 0; new_buf->curr_len < buf->curr_len; new_buf->curr_len++ ) |