1 #include <stdio.h> 2 perror_entry(void)3static int perror_entry(void) 4 { 5 FILE *stream; 6 stream = fopen( "nulltest.txt", "r" ); 7 if(stream == NULL) 8 { 9 printf("perror test:"); 10 perror("nulltest.txt"); 11 return -1; 12 } 13 fclose(stream); 14 return 0; 15 } 16 17 #include <utest.h> test_perror(void)18static void test_perror(void) 19 { 20 uassert_int_equal(perror_entry(), 0); 21 } testcase(void)22static void testcase(void) 23 { 24 UTEST_UNIT_RUN(test_perror); 25 } 26 UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10); 27 28