Move tst-signal-numbers to Python
Joseph Myers
joseph@codesourcery.com
Mon Dec 10 15:22:00 GMT 2018
On Mon, 10 Dec 2018, Florian Weimer wrote:
> I would expect something not based on regular expression for those
> filters, and it's odd there are two of them. I don't think using two
> filters does not include expressiveness here.
>
> re_signal_macro = re.compile(r'^SIG[A-Z].*')
> ignored_macros = set("SIGCLD SIGIOT SIGSWI SIGUNUSED"
> " SIGSTKSZ SIGRTMIN SIGRTMAX".split())
> def signal_macro(name):
> return re_signal_macro.match(name) and name not in ignored_macros
I don't want to require separate Python code for each such test. Once
there are a few more such tests, I think it will become natural to have a
single Python script that reads text files describing the headers and
constants to compare - with separate Python code only for more unusual
cases.
I think having a regular expression to describe macros to include, and one
to describe those to exclude, naturally matches multiple use cases for
such tests. Consider e.g. a test for MAP_* macros, which might compare
MAP_[A-Z].* but exclude MAP_HUGE_[0-9].* from the comparison, without
wanting to list all the macros such as MAP_HUGE_256MB individually.
(That's an example of a case that will also need a kernel version to be
specified, so that extra macros are allowed on the glibc side if the
kernel headers are older, and extra macros are allowed on the kernel side
if the kernel headers are newer.)
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list