[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why my AT_CHECK() can't work?
From: |
Eric Blake |
Subject: |
Re: Why my AT_CHECK() can't work? |
Date: |
Fri, 18 Aug 2017 10:48:43 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 08/17/2017 10:54 PM, Sam wrote:
> Could I use regular match in AT_CHECK? Like this:
Please don't top-post on technical lists; it makes it harder to follow
the conversation.
>
> m4_define([OVS_VSWITCHD_STOP],
>> [AT_CHECK([/etc/init.d/openvswitch stop], [0], [stdout], [])
>> AT_CHECK([[awk '/Killing ovsdb-server/' stdout | sed -e 's/[ ]*$//g']],
That's a lot of typing and a waste of a process. Why not just use the
shorter:
AT_CHECK([sed -n '/Killing ovsdb-server/ s/ *$//p' stdout],
(that is, using 'awk' as a longhand for 'grep' followed immediately by
piping through 'sed' is pointless, when you can do it all in 'sed'; and
using 'g' on a substitution anchored at the end of a line is pointless).
>> [0], [Killing ovsdb-server ([0-9]*)
AT_CHECK only does direct textual matches. But never fear - you can do
filtering as part of your command to pre-process the actual text into
something that will match your expected text - similar to how you are
eating trailing space, you can also convert random pids into a stable
placeholder, as in this example:
AT_CHECK([sed -n '/Killing ovsdb-server/ { s/ *$//; s/[0-9]*/PID/; p }'
stdout],
[0], [Killing ovsdb-server (PID)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Why my AT_CHECK() can't work?, Sam, 2017/08/09
- Re: Why my AT_CHECK() can't work?, Sam, 2017/08/09
- Re: Why my AT_CHECK() can't work?, Eric Blake, 2017/08/09
- Re: Why my AT_CHECK() can't work?, Zack Weinberg, 2017/08/09
- Re: Why my AT_CHECK() can't work?, Sam, 2017/08/09
- Re: Why my AT_CHECK() can't work?, Sam, 2017/08/09
- Re: Why my AT_CHECK() can't work?, Eric Blake, 2017/08/10
- Re: Why my AT_CHECK() can't work?, Sam, 2017/08/17
- Re: Why my AT_CHECK() can't work?,
Eric Blake <=
Re: Why my AT_CHECK() can't work?, Eric Blake, 2017/08/09