Remove testonly keyword

This commit is contained in:
Justine Tunney 2022-09-05 08:41:43 -07:00
parent 9be364d40a
commit d721ff8938
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
31 changed files with 78 additions and 94 deletions

View file

@ -43,7 +43,6 @@
"forcealignargpointer=", "forcealignargpointer=",
"noasan=", "noasan=",
"noubsan=", "noubsan=",
"testonly=",
"donothing=", "donothing=",
"nosideeffect=", "nosideeffect=",
"unreachable=",, "unreachable=",,

View file

@ -602,7 +602,6 @@ typedef struct {
} while (0) } while (0)
#ifndef __STRICT_ANSI__ #ifndef __STRICT_ANSI__
#define testonly dontinline _Section(".test")
#define textstartup _Section(".text.startup") noinstrument #define textstartup _Section(".text.startup") noinstrument
#define textexit _Section(".text.exit") noinstrument #define textexit _Section(".text.exit") noinstrument
#define textreal _Section(".text.real") #define textreal _Section(".text.real")
@ -610,7 +609,6 @@ typedef struct {
#define textwindows _Section(".text.windows") #define textwindows _Section(".text.windows")
#define antiquity _Section(".text.antiquity") #define antiquity _Section(".text.antiquity")
#else #else
#define testonly
#define textstartup #define textstartup
#define textexit #define textexit
#define textreal #define textreal

View file

@ -21,7 +21,7 @@
#define EPSILON 0.00000001L #define EPSILON 0.00000001L
testonly bool testlib_almostequallongdouble(long double x, long double y) { bool testlib_almostequallongdouble(long double x, long double y) {
/* TODO(jart): This algorithm has to be binary. */ /* TODO(jart): This algorithm has to be binary. */
if (isnan(x) || isnan(y)) return false; if (isnan(x) || isnan(y)) return false;
return fabsl(x - y) <= EPSILON; return fabsl(x - y) <= EPSILON;

View file

@ -26,8 +26,7 @@
* *
* @see libc/nexgen32e/kCp437.S * @see libc/nexgen32e/kCp437.S
*/ */
testonly bool testlib_binequals(const char16_t *want, const void *got, bool testlib_binequals(const char16_t *want, const void *got, size_t n) {
size_t n) {
size_t i; size_t i;
const unsigned char *p = (const unsigned char *)got; const unsigned char *p = (const unsigned char *)got;
if (!got) return false; if (!got) return false;

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/intrin/safemacros.internal.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
@ -33,7 +33,7 @@ struct ComboProduct {
struct ComboGroup groups[]; struct ComboGroup groups[];
}; };
mallocesque testonly struct ComboProduct *testlib_setupcomboproduct( mallocesque struct ComboProduct *testlib_setupcomboproduct(
const struct TestFixture *start, const struct TestFixture *end) { const struct TestFixture *start, const struct TestFixture *end) {
unsigned i, j, entrycount; unsigned i, j, entrycount;
struct ComboProduct *product; struct ComboProduct *product;
@ -54,8 +54,8 @@ mallocesque testonly struct ComboProduct *testlib_setupcomboproduct(
return product; return product;
} }
static testonly void testlib_describecombo(struct ComboProduct *product, static void testlib_describecombo(struct ComboProduct *product,
const struct TestFixture *combos) { const struct TestFixture *combos) {
char *p = &g_fixturename[0]; char *p = &g_fixturename[0];
char *pe = p + sizeof(g_fixturename); char *pe = p + sizeof(g_fixturename);
for (unsigned i = 0; i < product->n && p < pe; ++i) { for (unsigned i = 0; i < product->n && p < pe; ++i) {
@ -66,10 +66,9 @@ static testonly void testlib_describecombo(struct ComboProduct *product,
} }
} }
static testonly void testlib_callcombos(struct ComboProduct *product, static void testlib_callcombos(struct ComboProduct *product,
const struct TestFixture *combos, const struct TestFixture *combos,
testfn_t *test_start, testfn_t *test_start, testfn_t *test_end) {
testfn_t *test_end) {
for (;;) { for (;;) {
testlib_describecombo(product, combos); testlib_describecombo(product, combos);
for (unsigned i = 0; i < product->n; ++i) { for (unsigned i = 0; i < product->n; ++i) {
@ -89,9 +88,9 @@ static testonly void testlib_callcombos(struct ComboProduct *product,
* @see ape/ape.lds * @see ape/ape.lds
* @see libc/testlib/testlib.h * @see libc/testlib/testlib.h
*/ */
testonly void testlib_runcombos(testfn_t *test_start, testfn_t *test_end, void testlib_runcombos(testfn_t *test_start, testfn_t *test_end,
const struct TestFixture *combo_start, const struct TestFixture *combo_start,
const struct TestFixture *combo_end) { const struct TestFixture *combo_end) {
struct ComboProduct *product; struct ComboProduct *product;
product = testlib_setupcomboproduct(combo_start, combo_end); product = testlib_setupcomboproduct(combo_start, combo_end);
testlib_callcombos(product, combo_start, test_start, test_end); testlib_callcombos(product, combo_start, test_start, test_end);

View file

@ -19,7 +19,7 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
testonly bool testlib_contains(size_t cw, const void *s, const void *needle) { bool testlib_contains(size_t cw, const void *s, const void *needle) {
if (s == needle) return true; if (s == needle) return true;
if (!s || !needle) return false; if (!s || !needle) return false;
return sizeof(cw) == sizeof(char16_t) ? !!strstr16(s, needle) return sizeof(cw) == sizeof(char16_t) ? !!strstr16(s, needle)

View file

@ -19,10 +19,10 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
testonly bool testlib_endswith(size_t cw, const void *s, const void *suffix) { bool testlib_endswith(size_t cw, const void *s, const void *suffix) {
if (s == suffix) return true; if (s == suffix) return true;
if (!s || !suffix) return false; if (!s || !suffix) return false;
return cw == sizeof(wchar_t) ? wcsendswith(s, suffix) return cw == sizeof(wchar_t) ? wcsendswith(s, suffix)
: cw == sizeof(char16_t) ? endswith16(s, suffix) : cw == sizeof(char16_t) ? endswith16(s, suffix)
: endswith(s, suffix); : endswith(s, suffix);
} }

View file

@ -21,8 +21,8 @@
#include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/prot.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
testonly int testlib_countfixtures(const struct TestFixture *start, int testlib_countfixtures(const struct TestFixture *start,
const struct TestFixture *end) { const struct TestFixture *end) {
return ((intptr_t)end - (intptr_t)start) / sizeof(struct TestFixture); return ((intptr_t)end - (intptr_t)start) / sizeof(struct TestFixture);
} }
@ -31,9 +31,9 @@ testonly int testlib_countfixtures(const struct TestFixture *start,
* @see ape/ape.lds * @see ape/ape.lds
* @see libc/testlib/testlib.h * @see libc/testlib/testlib.h
*/ */
testonly void testlib_runfixtures(testfn_t *test_start, testfn_t *test_end, void testlib_runfixtures(testfn_t *test_start, testfn_t *test_end,
const struct TestFixture *fixture_start, const struct TestFixture *fixture_start,
const struct TestFixture *fixture_end) { const struct TestFixture *fixture_end) {
unsigned i, count; unsigned i, count;
count = testlib_countfixtures(fixture_start, fixture_end); count = testlib_countfixtures(fixture_start, fixture_end);
for (i = 0; i < count && !g_testlib_failed; ++i) { for (i = 0; i < count && !g_testlib_failed; ++i) {

View file

@ -20,9 +20,8 @@
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/x/x.h" #include "libc/x/x.h"
testonly void testlib_formatbinaryasglyphs(const char16_t *want, void testlib_formatbinaryasglyphs(const char16_t *want, const void *got,
const void *got, size_t n, size_t n, char **out_v1, char **out_v2) {
char **out_v1, char **out_v2) {
if (n == -1ul) n = strlen16(want); if (n == -1ul) n = strlen16(want);
*out_v1 = xasprintf("%`#.*hs", n, want); *out_v1 = xasprintf("%`#.*hs", n, want);
*out_v2 = xasprintf(" %`'#.*s", n, got); *out_v2 = xasprintf(" %`'#.*s", n, got);

View file

@ -21,9 +21,8 @@
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/x/x.h" #include "libc/x/x.h"
testonly void testlib_formatbinaryashex(const char *want, const void *got, void testlib_formatbinaryashex(const char *want, const void *got, size_t n,
size_t n, char **out_v1, char **out_v1, char **out_v2) {
char **out_v2) {
size_t i; size_t i;
uint8_t b; uint8_t b;
char *gothex; char *gothex;

View file

@ -22,6 +22,6 @@
#include "libc/x/x.h" #include "libc/x/x.h"
#include "third_party/gdtoa/gdtoa.h" #include "third_party/gdtoa/gdtoa.h"
testonly char *testlib_formatfloat(long double x) { char *testlib_formatfloat(long double x) {
return xasprintf("%.15Lg", x); return xasprintf("%.15Lg", x);
} }

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/intrin/bits.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/intrin/bits.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
@ -25,7 +25,7 @@
static size_t sbufi_; static size_t sbufi_;
static char sbufs_[2][256]; static char sbufs_[2][256];
dontdiscard testonly char *testlib_formatint(intptr_t x) { dontdiscard char *testlib_formatint(intptr_t x) {
char *str = sbufi_ < ARRAYLEN(sbufs_) ? sbufs_[sbufi_++] : malloc(256); char *str = sbufi_ < ARRAYLEN(sbufs_) ? sbufs_[sbufi_++] : malloc(256);
char *p = str; char *p = str;
p += sprintf(p, "%ld\t(or %#lx", x, x); p += sprintf(p, "%ld\t(or %#lx", x, x);

View file

@ -19,6 +19,6 @@
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/x/x.h" #include "libc/x/x.h"
dontdiscard testonly char *testlib_formatrange(intptr_t beg, intptr_t end) { dontdiscard char *testlib_formatrange(intptr_t beg, intptr_t end) {
return xasprintf("[%#ld,%#ld]", beg, end); return xasprintf("[%#ld,%#ld]", beg, end);
} }

View file

@ -25,7 +25,7 @@
/** /**
* Turns string into code. * Turns string into code.
*/ */
dontdiscard testonly char *testlib_formatstr(size_t cw, const void *s, int n) { dontdiscard char *testlib_formatstr(size_t cw, const void *s, int n) {
if (s) { if (s) {
switch (cw) { switch (cw) {
case 1: case 1:

View file

@ -26,7 +26,7 @@
* *
* @see unhexstr() * @see unhexstr()
*/ */
testonly bool testlib_hexequals(const char *want, const void *got, size_t n) { bool testlib_hexequals(const char *want, const void *got, size_t n) {
size_t i; size_t i;
const unsigned char *p = (const unsigned char *)got; const unsigned char *p = (const unsigned char *)got;
if (!got) return false; if (!got) return false;

View file

@ -28,7 +28,7 @@
* @see libc/testlib/testlib.h * @see libc/testlib/testlib.h
* @see ape/ape.lds * @see ape/ape.lds
*/ */
testonly void testlib_runalltests(void) { void testlib_runalltests(void) {
if ((intptr_t)__testcase_end > (intptr_t)__testcase_start) { if ((intptr_t)__testcase_end > (intptr_t)__testcase_start) {
if (testlib_countfixtures(__combo_start, __combo_end)) { if (testlib_countfixtures(__combo_start, __combo_end)) {
testlib_runcombos(__testcase_start, __testcase_end, __combo_start, testlib_runcombos(__testcase_start, __testcase_end, __combo_start,

View file

@ -16,12 +16,12 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/intrin/atomic.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/intrin/atomic.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/log/color.internal.h" #include "libc/log/color.internal.h"
#include "libc/log/internal.h" #include "libc/log/internal.h"
#include "libc/log/libfatal.internal.h" #include "libc/log/libfatal.internal.h"
@ -35,9 +35,9 @@ const char *testlib_showerror_isfatal;
const char *testlib_showerror_macro; const char *testlib_showerror_macro;
const char *testlib_showerror_symbol; const char *testlib_showerror_symbol;
testonly void testlib_showerror(const char *file, int line, const char *func, void testlib_showerror(const char *file, int line, const char *func,
const char *method, const char *symbol, const char *method, const char *symbol, const char *code,
const char *code, char *v1, char *v2) { char *v1, char *v2) {
char *p; char *p;
char hostname[128]; char hostname[128];
__stpcpy(hostname, "unknown"); __stpcpy(hostname, "unknown");
@ -56,9 +56,9 @@ testonly void testlib_showerror(const char *file, int line, const char *func,
} }
/* TODO(jart): Pay off tech debt re duplication */ /* TODO(jart): Pay off tech debt re duplication */
testonly void testlib_showerror_(int line, const char *wantcode, void testlib_showerror_(int line, const char *wantcode, const char *gotcode,
const char *gotcode, char *FREED_want, char *FREED_want, char *FREED_got, const char *fmt,
char *FREED_got, const char *fmt, ...) { ...) {
int e; int e;
va_list va; va_list va;
char hostname[128]; char hostname[128];

View file

@ -19,11 +19,10 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
testonly bool testlib_startswith(size_t cw, const void *s, const void *prefix) { bool testlib_startswith(size_t cw, const void *s, const void *prefix) {
if (s == prefix) return true; if (s == prefix) return true;
if (!s || !prefix) return false; if (!s || !prefix) return false;
return cw == sizeof(wchar_t) return cw == sizeof(wchar_t) ? wcsstartswith(s, prefix)
? wcsstartswith(s, prefix) : cw == sizeof(char16_t) ? startswith16(s, prefix)
: cw == sizeof(char16_t) ? startswith16(s, prefix) : startswith(s, prefix);
: startswith(s, prefix);
} }

View file

@ -20,16 +20,15 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
testonly bool testlib_strcaseequals(size_t cw, const void *s1, const void *s2) { bool testlib_strcaseequals(size_t cw, const void *s1, const void *s2) {
return testlib_strncaseequals(cw, s1, s2, SIZE_MAX); return testlib_strncaseequals(cw, s1, s2, SIZE_MAX);
} }
testonly bool testlib_strncaseequals(size_t cw, const void *s1, const void *s2, bool testlib_strncaseequals(size_t cw, const void *s1, const void *s2,
size_t n) { size_t n) {
if (s1 == s2) return true; if (s1 == s2) return true;
if (!s1 || !s2) return false; if (!s1 || !s2) return false;
return (cw == sizeof(wchar_t) return (cw == sizeof(wchar_t) ? wcsncasecmp(s1, s2, n)
? wcsncasecmp(s1, s2, n) : cw == sizeof(char16_t) ? strncasecmp16(s1, s2, n)
: cw == sizeof(char16_t) ? strncasecmp16(s1, s2, n) : strncasecmp(s1, s2, n)) == 0;
: strncasecmp(s1, s2, n)) == 0;
} }

View file

@ -20,16 +20,14 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
testonly bool testlib_strequals(size_t cw, const void *s1, const void *s2) { bool testlib_strequals(size_t cw, const void *s1, const void *s2) {
return testlib_strnequals(cw, s1, s2, SIZE_MAX); return testlib_strnequals(cw, s1, s2, SIZE_MAX);
} }
testonly bool testlib_strnequals(size_t cw, const void *s1, const void *s2, bool testlib_strnequals(size_t cw, const void *s1, const void *s2, size_t n) {
size_t n) {
if (s1 == s2) return true; if (s1 == s2) return true;
if (!s1 || !s2) return false; if (!s1 || !s2) return false;
return (cw == sizeof(wchar_t) return (cw == sizeof(wchar_t) ? wcsncmp(s1, s2, n)
? wcsncmp(s1, s2, n) : cw == sizeof(char16_t) ? strncmp16(s1, s2, n)
: cw == sizeof(char16_t) ? strncmp16(s1, s2, n) : strncmp(s1, s2, n)) == 0;
: strncmp(s1, s2, n)) == 0;
} }

View file

@ -72,7 +72,7 @@ COSMOPOLITAN_C_START_
#define __TEST_PROTOTYPE(S, N, A, K) \ #define __TEST_PROTOTYPE(S, N, A, K) \
void S##_##N(void); \ void S##_##N(void); \
testfn_t S##_##N##_ptr[] A(S##_##N) = {S##_##N}; \ testfn_t S##_##N##_ptr[] A(S##_##N) = {S##_##N}; \
testonly K void S##_##N(void) K void S##_##N(void)
#define __TEST_SECTION(NAME, CONTENT) \ #define __TEST_SECTION(NAME, CONTENT) \
".section " NAME "\n" CONTENT "\n\t.previous\n" ".section " NAME "\n" CONTENT "\n\t.previous\n"
@ -89,7 +89,7 @@ COSMOPOLITAN_C_START_
"\t.quad\t" STRINGIFY(GROUP##_##ENTRY)) \ "\t.quad\t" STRINGIFY(GROUP##_##ENTRY)) \
__ROSTR("1:\t.asciz\t" STRINGIFY(#GROUP)) \ __ROSTR("1:\t.asciz\t" STRINGIFY(#GROUP)) \
__ROSTR("2:\t.asciz\t" STRINGIFY(#ENTRY))); \ __ROSTR("2:\t.asciz\t" STRINGIFY(#ENTRY))); \
testonly void GROUP##_##ENTRY(void) void GROUP##_##ENTRY(void)
/** /**
* Enables setup and teardown of test directories. * Enables setup and teardown of test directories.

View file

@ -193,8 +193,7 @@ static void CheckForZombies(void) {
/** /**
* Runs all test case functions in sorted order. * Runs all test case functions in sorted order.
*/ */
testonly void testlib_runtestcases(testfn_t *start, testfn_t *end, void testlib_runtestcases(testfn_t *start, testfn_t *end, testfn_t warmup) {
testfn_t warmup) {
/* /*
* getpid() calls are inserted to help visually see tests in traces * getpid() calls are inserted to help visually see tests in traces
* which can be performed on Linux, FreeBSD, OpenBSD, and XNU: * which can be performed on Linux, FreeBSD, OpenBSD, and XNU:

View file

@ -26,7 +26,7 @@
#include "libc/testlib/ezbench.h" #include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
testonly void OnUsr1(int sig) { void OnUsr1(int sig) {
_exit(0); _exit(0);
} }

View file

@ -24,11 +24,11 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include "libc/intrin/pushpop.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h" #include "libc/fmt/itoa.h"
#include "libc/intrin/pushpop.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/limits.h" #include "libc/limits.h"
#include "libc/math.h" #include "libc/math.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
@ -541,14 +541,14 @@ TEST(sprintf, test_snprintf) {
EXPECT_STREQ("-1", buffer); EXPECT_STREQ("-1", buffer);
} }
testonly void vsnprintf_builder_1(char *buf, ...) { void vsnprintf_builder_1(char *buf, ...) {
va_list args; va_list args;
va_start(args, buf); va_start(args, buf);
vsnprintf(buf, 100U, "%d", args); vsnprintf(buf, 100U, "%d", args);
va_end(args); va_end(args);
} }
testonly void vsnprintf_builder_3(char *buf, ...) { void vsnprintf_builder_3(char *buf, ...) {
va_list args; va_list args;
va_start(args, buf); va_start(args, buf);
vsnprintf(buf, 100U, "%d %d %s", args); vsnprintf(buf, 100U, "%d %d %s", args);

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/mem/critbit0.h"
#include "libc/intrin/bits.h" #include "libc/intrin/bits.h"
#include "libc/mem/critbit0.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/str/str.h" #include "libc/str/str.h"
@ -29,25 +29,25 @@ struct Bog {
const char *p[]; const char *p[];
}; };
static testonly dontdiscard struct Bog *NewBog(unsigned n) { static dontdiscard struct Bog *NewBog(unsigned n) {
struct Bog *res = malloc(sizeof(struct Bog) + sizeof(const char *) * n); struct Bog *res = malloc(sizeof(struct Bog) + sizeof(const char *) * n);
res->i = 0; res->i = 0;
res->n = n; res->n = n;
return res; return res;
} }
static testonly void ClearBog(struct Bog *bog) { static void ClearBog(struct Bog *bog) {
bog->i = 0; bog->i = 0;
} }
static testonly void FreeBog(struct Bog **bog) { static void FreeBog(struct Bog **bog) {
free(*bog), *bog = NULL; free(*bog), *bog = NULL;
} }
static const char *const elems[] = {"a", "aa", "aaz", "abz", static const char *const elems[] = {"a", "aa", "aaz", "abz",
"bba", "bbc", "bbd", NULL}; "bba", "bbc", "bbd", NULL};
testonly static void MakeTree(struct critbit0 *tree) { static void MakeTree(struct critbit0 *tree) {
memset(tree, 0, sizeof(*tree)); memset(tree, 0, sizeof(*tree));
for (unsigned i = 0; elems[i]; ++i) { for (unsigned i = 0; elems[i]; ++i) {
ASSERT_EQ(true, critbit0_insert(tree, elems[i])); ASSERT_EQ(true, critbit0_insert(tree, elems[i]));
@ -84,7 +84,7 @@ TEST(critbit0, testDelete) {
critbit0_clear(&tree); critbit0_clear(&tree);
} }
static testonly intptr_t allprefixed_cb(const char *elem, void *arg) { static intptr_t allprefixed_cb(const char *elem, void *arg) {
struct Bog *bog = arg; struct Bog *bog = arg;
ASSERT_LT(bog->i, bog->n); ASSERT_LT(bog->i, bog->n);
bog->p[bog->i++] = elem; bog->p[bog->i++] = elem;
@ -110,7 +110,7 @@ TEST(critbit0, testAllPrefixed) {
FreeBog(&a); FreeBog(&a);
} }
static testonly intptr_t allprefixed_cb_halt(const char *elem, void *arg) { static intptr_t allprefixed_cb_halt(const char *elem, void *arg) {
struct Bog *bog = arg; struct Bog *bog = arg;
ASSERT_LT(bog->i, bog->n); ASSERT_LT(bog->i, bog->n);
bog->p[bog->i++] = elem; bog->p[bog->i++] = elem;

View file

@ -489,14 +489,14 @@ TEST(wcsncmp, testTwosComplementBane) {
test/libc/str/strcmp_test.c § benchmarks test/libc/str/strcmp_test.c § benchmarks
*/ */
testonly dontinline int strcmp_pure(const char *a, const char *b) { dontinline int strcmp_pure(const char *a, const char *b) {
for (; *a == *b; a++, b++) { for (; *a == *b; a++, b++) {
if (!*a) break; if (!*a) break;
} }
return (*a & 0xff) - (*b & 0xff); return (*a & 0xff) - (*b & 0xff);
} }
testonly dontinline int strcasecmp_pure(const char *a, const char *b) { dontinline int strcasecmp_pure(const char *a, const char *b) {
for (; *a && *b; a++, b++) { for (; *a && *b; a++, b++) {
if (!(*a == *b || tolower(*a & 0xff) == tolower(*b & 0xff))) { if (!(*a == *b || tolower(*a & 0xff) == tolower(*b & 0xff))) {
break; break;

View file

@ -28,7 +28,7 @@ textstartup static void strftime_test_init(void) {
} }
const void *const strftime_test_ctor[] initarray = {strftime_test_init}; const void *const strftime_test_ctor[] initarray = {strftime_test_init};
testonly char *FormatTime(const char *fmt, struct tm *tm) { char *FormatTime(const char *fmt, struct tm *tm) {
static char buf[64]; static char buf[64];
strftime(buf, sizeof(buf), fmt, tm); strftime(buf, sizeof(buf), fmt, tm);
return &buf[0]; return &buf[0];

View file

@ -25,7 +25,7 @@
#include "test/libc/xed/lib.h" #include "test/libc/xed/lib.h"
#include "third_party/xed/x86.h" #include "third_party/xed/x86.h"
testonly dontdiscard uint8_t *unbingx86op(const char16_t *codez) { dontdiscard uint8_t *unbingx86op(const char16_t *codez) {
size_t len; size_t len;
len = strlen16(codez); len = strlen16(codez);
return unbingbuf(xmalloc(ROUNDUP(len, 16)), len, codez, 0x90); return unbingbuf(xmalloc(ROUNDUP(len, 16)), len, codez, 0x90);
@ -34,7 +34,7 @@ testonly dontdiscard uint8_t *unbingx86op(const char16_t *codez) {
/** /**
* Long mode instruction length decoder. * Long mode instruction length decoder.
*/ */
testonly int ild(const char16_t *codez) { int ild(const char16_t *codez) {
int error; int error;
struct XedDecodedInst xedd; struct XedDecodedInst xedd;
error = xed_instruction_length_decode( error = xed_instruction_length_decode(
@ -46,7 +46,7 @@ testonly int ild(const char16_t *codez) {
/** /**
* Real mode instruction length decoder. * Real mode instruction length decoder.
*/ */
testonly int ildreal(const char16_t *codez) { int ildreal(const char16_t *codez) {
int error; int error;
struct XedDecodedInst xedd; struct XedDecodedInst xedd;
error = xed_instruction_length_decode( error = xed_instruction_length_decode(
@ -58,7 +58,7 @@ testonly int ildreal(const char16_t *codez) {
/** /**
* Legacy mode instruction length decoder. * Legacy mode instruction length decoder.
*/ */
testonly int ildlegacy(const char16_t *codez) { int ildlegacy(const char16_t *codez) {
int error; int error;
struct XedDecodedInst xedd; struct XedDecodedInst xedd;
error = xed_instruction_length_decode( error = xed_instruction_length_decode(

View file

@ -84,7 +84,6 @@ Keywords={
"offsetof", "offsetof",
"microarchitecture", "microarchitecture",
"targetclones", "targetclones",
"testonly",
"forcealignargpointer", "forcealignargpointer",
"textexit", "textexit",
"externinline", "externinline",

View file

@ -26,7 +26,6 @@
"offsetof" "offsetof"
"microarchitecture" "microarchitecture"
"targetclones" "targetclones"
"testonly"
"forcealignargpointer" "forcealignargpointer"
"textexit" "textexit"
"externinline" "externinline"

View file

@ -369,7 +369,6 @@ cosmo_kws = frozenset([
"scanfesque", "scanfesque",
"strftimeesque", "strftimeesque",
"strlenesque", "strlenesque",
"testonly",
"textexit", "textexit",
"textreal", "textreal",
"textstartup", "textstartup",
@ -432,7 +431,6 @@ cosmo_kws = frozenset([
"scanfesque", "scanfesque",
"strftimeesque", "strftimeesque",
"strlenesque", "strlenesque",
"testonly",
"textexit", "textexit",
"textreal", "textreal",
"textstartup", "textstartup",