Review Board 1.7.16


clang compiler warning: fixes for tests to be compiled using clang

Review Request #4555 - Created March 29, 2015 and submitted

Diederik de Groot
13
ASTERISK-24917
Reviewers
asterisk-dev
Asterisk
clang's static analyzer will throw quite a number warnings / errors during compilation, some of which can be very helpfull in finding corner-case bugs. 

fixes for tests to be compiled using clang
executing the tests one-by-one works fine (completes to end) (skipping /main/stdtime) -> 
test show results failed:


=================== /main/message/ ====== 
FAIL   test_message_queue_handler_nom /main/message/             31036ms
[test_message.c:int handler_wait_for_message(struct ast_test *):244]: Test timed out while waiting for handler to get message

Not sure if this is actually a fail or just a timeout. WIP


=================== /main/strings/ ====== 
FAIL   escape_semicolons              /main/strings/             1ms     
[Mar 29 20:13:43] ERROR[2521]: utils.c:493 char *ast_escape_semicolons(const char *, char *, int): FRACK!, Failed assertion string != NULL && outbuf != NULL (0)
-> explainable by the change made to the source. ast_alloca(0) is not being executed -> test2 = NULL: need to resolv the open question how to handle ast_alloca(0) before making any further changes.

(With revision 5 of this code, this test now passes without a problem, had to fix both the test and the function being tested though)


=================== /main/stdtime ====== 
"test execute all" fails, caused by the /main/stdtime/ test. 
START  /main/stdtime/ - timezone_watch 
[test_time.c:enum ast_test_result_state test_timezone_watch(struct ast_test_info *, enum ast_test_command, struct ast_test *):84]: Executing deletion test...
j62747*CLI> 
CLI becomes unresponsive / no further command completion for example.
Guess this will need a little further investigation. Maybe the source changes made to main/stdtime/ where not completely correct.

Seems to be caused by inotify_daemon, at least there is where the segfault happens. WIP
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" time="181.742" tests="444" n
<properties>
<property name="version" value="SV

Changes between revision 1 and 2

1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9

  1. /branches/13/tests/test_strings.c: Loading...
/branches/13/tests/test_strings.c
Diff Revision 1 Diff Revision 2
[20] 423 lines
[+20] [+] AST_TEST_DEFINE(escape_semicolons_test)
424
	ast_test_validate(test, test_semi(";", "\\;", 3));
424
	ast_test_validate(test, test_semi(";", "\\;", 3));
425

    
   
425

   
426
	/* The following tests should return empty because there's not enough room to output
426
	/* The following tests should return empty because there's not enough room to output
427
	 * an escaped ; or even a single character.
427
	 * an escaped ; or even a single character.
428
	 */
428
	 */
429
	ast_test_validate(test, test_semi(";", "1", 0));
429
	ast_test_validate(test, test_semi(";", "", 0));
430
	ast_test_validate(test, test_semi(";", "2", 1));
430
	ast_test_validate(test, test_semi(";", "", 1));
431
	ast_test_validate(test, test_semi(";", "3", 2));
431
	ast_test_validate(test, test_semi(";", "", 2));
432
	ast_test_validate(test, test_semi("x", "4", 0));
432
	ast_test_validate(test, test_semi("x", "", 0));
433
	ast_test_validate(test, test_semi("x", "5", 1));
433
	ast_test_validate(test, test_semi("x", "", 1));
434

    
   
434

   
435
	/* At least some output should be produced now. */
435
	/* At least some output should be produced now. */
436
	ast_test_validate(test, test_semi("xx;xx", "x", 2));
436
	ast_test_validate(test, test_semi("xx;xx", "x", 2));
437
	ast_test_validate(test, test_semi("xx;xx", "xx", 3));
437
	ast_test_validate(test, test_semi("xx;xx", "xx", 3));
438

    
   
438

   
[+20] [20] 40 lines
  1. /branches/13/tests/test_strings.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.