12 /* Avoid SSP re-definitions */
18 #define KPRINTF_BUFSIZE 1024
20 #define putchar xputchar
21 static int putchar(char c, int foo, void *b)
23 return fputc(c, stderr);
27 static const char HEXDIGITS[] = "0123456789ABCDEF";
28 static const char hexdigits[] = "0123456789abcdef";
32 #define device_xname(a) ""
33 int kprintf(const char *, int, void *, char *, va_list) __printflike(1, 0);
34 void device_printf(device_t, const char *, ...) __printflike(2, 3);
41 static void (*v_flush)(void) = empty;
43 ATF_TC(snprintf_print);
44 ATF_TC_HEAD(snprintf_print, tc)
46 atf_tc_set_md_var(tc, "descr", "checks snprintf print");
49 ATF_TC_BODY(snprintf_print, tc)
54 memset(buf, 'x', sizeof(buf));
55 i = snprintf(buf, sizeof(buf), "number %d", 10);
57 ATF_CHECK_STREQ(buf, "number 10");
60 ATF_TC(snprintf_print_overflow);
61 ATF_TC_HEAD(snprintf_print_overflow, tc)
63 atf_tc_set_md_var(tc, "descr", "checks snprintf print with overflow");
66 ATF_TC_BODY(snprintf_print_overflow, tc)
71 memset(buf, 'x', sizeof(buf));
72 i = snprintf(buf, sizeof(buf), "fjsdfsdjfsdf %d\n", 10);
74 ATF_CHECK_STREQ(buf, "fjsdfsdjf");
77 ATF_TC(snprintf_count);
78 ATF_TC_HEAD(snprintf_count, tc)
80 atf_tc_set_md_var(tc, "descr", "checks snprintf count");
83 ATF_TC_BODY(snprintf_count, tc)
87 i = snprintf(NULL, 20, "number %d", 10);
91 ATF_TC(snprintf_count_overflow);
92 ATF_TC_HEAD(snprintf_count_overflow, tc)
94 atf_tc_set_md_var(tc, "descr", "checks snprintf count with overflow");
97 ATF_TC_BODY(snprintf_count_overflow, tc)
101 i = snprintf(NULL, 10, "fjsdfsdjfsdf %d\n", 10);
107 ATF_TP_ADD_TC(tp, snprintf_print);
108 ATF_TP_ADD_TC(tp, snprintf_print_overflow);
109 ATF_TP_ADD_TC(tp, snprintf_count);
110 ATF_TP_ADD_TC(tp, snprintf_count_overflow);
112 return atf_no_error();