Lines Matching refs:test

113 		pr_err("error in test suite: expected output length %d too long. Format was '%s'.\n",
124 * enough and 0), and then we also test that kvasprintf would
146 #define test(expect, fmt, ...) \
155 test("", &nul);
156 test("100%", "100%%");
157 test("xxx%yyy", "xxx%cyyy", '%');
164 test("0x1234abcd ", "%#-12x", 0x1234abcd);
165 test(" 0x1234abcd", "%#12x", 0x1234abcd);
166 test("0|001| 12|+123| 1234|-123|-1234", "%d|%03d|%3d|%+d|% d|%+d|% d", 0, 1, 12, 123, 1234, -123, -1234);
167 NOWARN(-Wformat, "Intentionally test narrowing conversion specifiers.", {
168 test("0|1|1|128|255", "%hhu|%hhu|%hhu|%hhu|%hhu", 0, 1, 257, 128, -1);
169 test("0|1|1|-128|-1", "%hhd|%hhd|%hhd|%hhd|%hhd", 0, 1, 257, 128, -1);
170 test("2015122420151225", "%ho%ho%#ho", 1037, 5282, -11627);
175 * from the below test should really be "00|0||| ". However,
177 * case. This test case simply documents the current
180 test("00|0|0|0|0", "%.2d|%.1d|%.0d|%.*d|%1.0d", 0, 0, 0, 0, 0, 0);
186 test("", "%s%.0s", "", "123");
187 test("ABCD|abc|123", "%s|%.3s|%.*s", "ABCD", "abcdef", 3, "123456");
188 test("1 | 2|3 | 4|5 ", "%-3s|%3s|%-*s|%*s|%*s", "1", "2", 3, "3", 3, "4", -3, "5");
189 test("1234 ", "%-10.4s", "123456");
190 test(" 1234", "%10.4s", "123456");
200 * These test cases document the current behaviour; should
204 test(" ", "%4.*s", -5, "123456");
205 test("123456", "%.s", "123456");
206 test("a||", "%.s|%.0s|%.*s", "a", "b", 0, "c");
207 test("a | | ", "%-3.s|%-3.0s|%-3.*s", "a", "b", 0, "c");
298 * We can't use test() to test %p because we don't know what output to expect
333 * No need to increase failed test counter since this is assumed
340 test(buf, fmt, p);
349 test(ZEROS "00000000", "%p", NULL);
350 test(ZEROS "00000000", "%px", NULL);
351 test("(null)", "%pE", NULL);
360 test(ONES "fffffff5", "%p", ERR_PTR(-11));
361 test(ONES "fffffff5", "%px", ERR_PTR(-11));
362 test("(efault)", "%pE", ERR_PTR(-11));
371 test(ZEROS "000000ab", "%px", PTR_INVALID);
372 test("(efault)", "%pE", PTR_INVALID);
383 /* We can't test this without access to kptr_restrict. */
406 test("c0 ff ee|c0:ff:ee|c0-ff-ee|c0ffee",
408 test("c0 ff ee|c0:ff:ee|c0-ff-ee|c0ffee",
417 test("2d:48:d6:fc:7a:05", "%pM", addr);
418 test("05:7a:fc:d6:48:2d", "%pMR", addr);
419 test("2d-48-d6-fc-7a-05", "%pMF", addr);
420 test("2d48d6fc7a05", "%pm", addr);
421 test("057afcd6482d", "%pmR", addr);
433 test("127.000.000.001|127.0.0.1", "%pi4|%pI4", &sa.sin_addr, &sa.sin_addr);
434 test("127.000.000.001|127.0.0.1", "%piS|%pIS", &sa, &sa);
436 test("001.002.003.004:12345|1.2.3.4:12345", "%piSp|%pISp", &sa, &sa);
457 test("00010203-0405-0607-0809-0a0b0c0d0e0f", "%pUb", uuid);
458 test("00010203-0405-0607-0809-0A0B0C0D0E0F", "%pUB", uuid);
459 test("03020100-0504-0706-0809-0a0b0c0d0e0f", "%pUl", uuid);
460 test("03020100-0504-0706-0809-0A0B0C0D0E0F", "%pUL", uuid);
481 test("foo", "%pd", &test_dentry[0]);
482 test("foo", "%pd2", &test_dentry[0]);
484 test("(null)", "%pd", NULL);
485 test("(efault)", "%pd", PTR_INVALID);
486 test("(null)", "%pD", NULL);
487 test("(efault)", "%pD", PTR_INVALID);
489 test("romeo", "%pd", &test_dentry[3]);
490 test("alfa/romeo", "%pd2", &test_dentry[3]);
491 test("bravo/alfa/romeo", "%pd3", &test_dentry[3]);
492 test("/bravo/alfa/romeo", "%pd4", &test_dentry[3]);
493 test("/bravo/alfa", "%pd4", &test_dentry[2]);
495 test("bravo/alfa |bravo/alfa ", "%-12pd2|%*pd2", &test_dentry[2], -12, &test_dentry[2]);
496 test(" bravo/alfa| bravo/alfa", "%12pd2|%*pd2", &test_dentry[2], 12, &test_dentry[2]);
519 test("(%pt?)", "%pt", &tm);
520 test("2018-11-26T05:35:43", "%ptR", &tm);
521 test("0118-10-26T05:35:43", "%ptRr", &tm);
522 test("05:35:43|2018-11-26", "%ptRt|%ptRd", &tm, &tm);
523 test("05:35:43|0118-10-26", "%ptRtr|%ptRdr", &tm, &tm);
524 test("05:35:43|2018-11-26", "%ptRttr|%ptRdtr", &tm, &tm);
525 test("05:35:43 tr|2018-11-26 tr", "%ptRt tr|%ptRd tr", &tm, &tm);
527 test("2019-01-04T15:32:23", "%ptT", &t);
528 test("0119-00-04T15:32:23", "%ptTr", &t);
529 test("15:32:23|2019-01-04", "%ptTt|%ptTd", &t, &t);
530 test("15:32:23|0119-00-04", "%ptTtr|%ptTdr", &t, &t);
532 test("2019-01-04 15:32:23", "%ptTs", &t);
533 test("0119-00-04 15:32:23", "%ptTsr", &t);
534 test("15:32:23|2019-01-04", "%ptTts|%ptTds", &t, &t);
535 test("15:32:23|0119-00-04", "%ptTtrs|%ptTdrs", &t, &t);
553 test("1-20,60000-60014", "%*pbl", nbits, bits);
565 test("00000|00000", "%20pb|%*pb", bits, 20, bits);
566 test("|", "%20pbl|%*pbl", bits, 20, bits);
570 test("a28ac|a28ac", "%20pb|%*pb", bits, 20, bits);
571 test("2-3,5,7,11,13,17,19|2-3,5,7,11,13,17,19", "%20pbl|%*pbl", bits, 20, bits);
574 test("fffff|fffff", "%20pb|%*pb", bits, 20, bits);
575 test("0-19|0-19", "%20pbl|%*pbl", bits, 20, bits);
641 test(cmp_buf, "%pGp", &flags);
654 test(cmp_buf, "%pGt", &page_type);
682 test("read|exec|mayread|maywrite|mayexec", "%pGv", &flags);
685 test("GFP_TRANSHUGE", "%pGg", &gfp);
688 test("GFP_ATOMIC|GFP_DMA", "%pGg", &gfp);
691 test("__GFP_HIGH", "%pGg", &gfp);
696 test(cmp_buffer, "%pGg", &gfp);
701 test(cmp_buffer, "%pGg", &gfp);
736 test(full_name_second, "%pfw", software_node_fwnode(&second));
737 test(full_name_third, "%pfw", software_node_fwnode(&third));
738 test(full_name_third, "%pfwf", software_node_fwnode(&third));
739 test(second_name, "%pfwP", software_node_fwnode(&second));
740 test(third_name, "%pfwP", software_node_fwnode(&third));
759 test(try[i].str, "%p4cc", &try[i].code);
765 test("-1234", "%pe", ERR_PTR(-1234));
772 test("(-ENOTSOCK)", "(%pe)", ERR_PTR(-ENOTSOCK));
773 test("(-EAGAIN)", "(%pe)", ERR_PTR(-EAGAIN));
775 test("(-EAGAIN)", "(%pe)", ERR_PTR(-EWOULDBLOCK));
776 test("[-EIO ]", "[%-8pe]", ERR_PTR(-EIO));
777 test("[ -EIO]", "[%8pe]", ERR_PTR(-EIO));
778 test("-EPROBE_DEFER", "%pe", ERR_PTR(-EPROBE_DEFER));