<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/bin/test/test.c, branch stable/14</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=stable%2F14</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=stable%2F14'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2026-01-02T20:44:28Z</updated>
<entry>
<title>sh: avoid warnings about too-long initializer strings</title>
<updated>2026-01-02T20:44:28Z</updated>
<author>
<name>Dimitry Andric</name>
<email>dim@FreeBSD.org</email>
</author>
<published>2025-12-25T20:13:48Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=3cd0026966d0174c7143ac1d8233ed81ffa68ddf'/>
<id>urn:sha1:3cd0026966d0174c7143ac1d8233ed81ffa68ddf</id>
<content type='text'>
Mark `optletter` and `t_op::op_text` as `__non_string`, to avoid
warnings from clang 21 similar to:

    bin/sh/options.h:77:36: error: initializer-string for character array is too long, array size is 19 but initializer has size 20 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
       77 | const char optletter[NSHORTOPTS] = "efIimnsxvVECabupTPh";
          |                                    ^~~~~~~~~~~~~~~~~~~~~
    bin/test/test.c:153:3: error: initializer-string for character array is too long, array size is 2 but initializer has size 3 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
      153 |         {"==",  STREQ},
          |          ^~~~

MFC after:	3 days
Reviewed by:	jilles
Differential Revision: https://reviews.freebsd.org/D54362

(cherry picked from commit e6546807f4c1a8a6a6fa53fceab7b8c80e3ed802)
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line .c pattern</title>
<updated>2023-08-16T17:54:42Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:42Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1d386b48a555f61cb7325543adbbb5c3f3407a66'/>
<id>urn:sha1:1d386b48a555f61cb7325543adbbb5c3f3407a66</id>
<content type='text'>
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
</content>
</entry>
<entry>
<title>Remove unused includes.</title>
<updated>2020-12-23T05:04:36Z</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2020-12-23T05:04:36Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1cc908de3ab2e11fca648fc874df2f9d255fc087'/>
<id>urn:sha1:1cc908de3ab2e11fca648fc874df2f9d255fc087</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Use NULL for pointers instead of 0.</title>
<updated>2016-04-19T00:38:07Z</updated>
<author>
<name>Marcelo Araujo</name>
<email>araujo@FreeBSD.org</email>
</author>
<published>2016-04-19T00:38:07Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=172c3b0b5f610e0b342aa70922a355e511a67f3a'/>
<id>urn:sha1:172c3b0b5f610e0b342aa70922a355e511a67f3a</id>
<content type='text'>
MFC after:	2 weeks.
</content>
</entry>
<entry>
<title>test: Optimize operator lookup.</title>
<updated>2016-01-30T19:59:58Z</updated>
<author>
<name>Jilles Tjoelker</name>
<email>jilles@FreeBSD.org</email>
</author>
<published>2016-01-30T19:59:58Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=f1602fa51152d9aed042b6b742216e33975bcf33'/>
<id>urn:sha1:f1602fa51152d9aed042b6b742216e33975bcf33</id>
<content type='text'>
The linear search using strcmp() shows up in pmcstat for several percent.

Split the operators into lengths and whether they start with '-' and compare
bytes using == instead of strcmp().

A simple test

sh -c 'i=0; w=$(printf %0100d 7); while [ "$i" -lt 1000000 ]; do
    v=$(printf %sx%s "$w" "$w"); i=$((i+1)); done'

is over 4% faster on an amd64 bhyve VM.
</content>
</entry>
<entry>
<title>test: Avoid looking up again the type of a known binary operator.</title>
<updated>2013-12-05T22:53:32Z</updated>
<author>
<name>Jilles Tjoelker</name>
<email>jilles@FreeBSD.org</email>
</author>
<published>2013-12-05T22:53:32Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=c80ad859e1a0f062dad42dd71efd40f1b6ef9184'/>
<id>urn:sha1:c80ad859e1a0f062dad42dd71efd40f1b6ef9184</id>
<content type='text'>
</content>
</entry>
<entry>
<title>test: Simplify the code by unifying op_num and op_type.</title>
<updated>2013-12-01T17:00:57Z</updated>
<author>
<name>Jilles Tjoelker</name>
<email>jilles@FreeBSD.org</email>
</author>
<published>2013-12-01T17:00:57Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=577ad9b2d303a89c3944a6c8a705d51dd4011dd6'/>
<id>urn:sha1:577ad9b2d303a89c3944a6c8a705d51dd4011dd6</id>
<content type='text'>
The global variable t_wp_op is no longer needed.
</content>
</entry>
<entry>
<title>test: Remove -ntXY and -otXY primaries.</title>
<updated>2013-05-31T22:54:20Z</updated>
<author>
<name>Jilles Tjoelker</name>
<email>jilles@FreeBSD.org</email>
</author>
<published>2013-05-31T22:54:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=f19825af72b3ab9e4a6faa1a6f09002aae9f48bd'/>
<id>urn:sha1:f19825af72b3ab9e4a6faa1a6f09002aae9f48bd</id>
<content type='text'>
This reverts commit r247274.

As maintainer of sh, I disapprove of this feature addition.

It is too specific and can be done without easily using find(1) or stat(1).
I will add some hints to the test(1) man page shortly.

In general, FreeBSD sh is not the place to invent new shell language
features. This is how it has been maintained and adding features randomly
does not work with that.

The new syntax (e.g. [ FILE1 -ntca FILE2 ]) looks cryptic to me.
</content>
</entry>
<entry>
<title>Enhance test(1) by adding provision to compare any combination of the</title>
<updated>2013-02-25T19:05:40Z</updated>
<author>
<name>Peter Jeremy</name>
<email>peterj@FreeBSD.org</email>
</author>
<published>2013-02-25T19:05:40Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=293beebc463697485b14136f4b2a5b1d154a3da9'/>
<id>urn:sha1:293beebc463697485b14136f4b2a5b1d154a3da9</id>
<content type='text'>
access, birth, change and modify times of two files, instead of only
being able to compare modify times.  The builtin test in sh(1) will
automagically acquire the same expansion.

Approved by:	grog
MFC after:	2 weeks
</content>
</entry>
<entry>
<title>test: Reduce code size of ops table.</title>
<updated>2011-11-25T23:45:29Z</updated>
<author>
<name>Jilles Tjoelker</name>
<email>jilles@FreeBSD.org</email>
</author>
<published>2011-11-25T23:45:29Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=ba22f6c6936b5b11eea306ec1f0ca51c120cd44c'/>
<id>urn:sha1:ba22f6c6936b5b11eea306ec1f0ca51c120cd44c</id>
<content type='text'>
</content>
</entry>
</feed>
