public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents
@ 2012-04-04  5:23 Garrett Cooper
  2012-04-04 17:22 ` Mike Frysinger
       [not found] ` <201204042028.52373.vapier@gentoo.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Garrett Cooper @ 2012-04-04  5:23 UTC (permalink / raw)
  To: ltp-list

The intent behind these changes are to remove unnecessary perl
dependencies in LTP by using awk in its stead. It was something that was
discussed a while ago on ltp-list@.

Garrett Cooper (4):
   Replace create_valgrind_check.pl with an awk equivalent
   Install .awk files
   Replace create_dmesg_entries_for_each_test.pl with an awk equivalent
   Replace create_kernel_faults_in_loops_and_probability.pl with an awk
     equivalent

  runltp                                             |   50 +++++----
  tools/Makefile                                     |    2 +-
  tools/create_dmesg_entries_for_each_test.awk       |   32 ++++++
  tools/create_dmesg_entries_for_each_test.pl        |   74 --------------
  ...eate_kernel_faults_in_loops_and_probability.awk |   40 ++++++++
  ...reate_kernel_faults_in_loops_and_probability.pl |  100 ------------------
  tools/create_valgrind_check.awk                    |   42 ++++++++
  tools/create_valgrind_check.pl                     |  106 --------------------
  8 files changed, 146 insertions(+), 300 deletions(-)
  create mode 100644 tools/create_dmesg_entries_for_each_test.awk
  delete mode 100644 tools/create_dmesg_entries_for_each_test.pl
  create mode 100644 tools/create_kernel_faults_in_loops_and_probability.awk
  delete mode 100755 tools/create_kernel_faults_in_loops_and_probability.pl
  create mode 100644 tools/create_valgrind_check.awk
  delete mode 100755 tools/create_valgrind_check.pl

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents
  2012-04-04  5:23 [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents Garrett Cooper
@ 2012-04-04 17:22 ` Mike Frysinger
  2012-04-04 17:31   ` Garrett Cooper
       [not found] ` <201204042028.52373.vapier@gentoo.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2012-04-04 17:22 UTC (permalink / raw)
  To: ltp-list


[-- Attachment #1.1: Type: Text/Plain, Size: 482 bytes --]

On Wednesday 04 April 2012 01:23:43 Garrett Cooper wrote:
> The intent behind these changes are to remove unnecessary perl
> dependencies in LTP by using awk in its stead. It was something that was
> discussed a while ago on ltp-list@.

i like awk over perl a lot.  my only concern is non-POSIX stuff slipping in 
(such as people who have gawk installed).  should we add a local wrapper 
script that sees if the awk accepts a --posix flag and automatically pass it ?
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 274 bytes --]

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents
  2012-04-04 17:22 ` Mike Frysinger
@ 2012-04-04 17:31   ` Garrett Cooper
  2012-04-04 17:54     ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Garrett Cooper @ 2012-04-04 17:31 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: ltp-list

On Wed, Apr 4, 2012 at 10:22 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Wednesday 04 April 2012 01:23:43 Garrett Cooper wrote:
>> The intent behind these changes are to remove unnecessary perl
>> dependencies in LTP by using awk in its stead. It was something that was
>> discussed a while ago on ltp-list@.
>
> i like awk over perl a lot.  my only concern is non-POSIX stuff slipping in
> (such as people who have gawk installed).  should we add a local wrapper
> script that sees if the awk accepts a --posix flag and automatically pass it ?

That's actually a gawk-ism :)...

$ uname -a
FreeBSD bayonetta.local 9.0-STABLE FreeBSD 9.0-STABLE #7 r233759M: Sun
Apr  1 11:35:59 PDT 2012
gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA
amd64
$ man awk | grep -- --posix || echo 'not found'
not found

Seeing how Android and some other Linux distros like borrowing bits
and pieces from BSD, I think that using --posix might not guarantee
much (on the bright side it doesn't error out either with 'the
one-true-awk'):

$ man awk | awk --posix 'END { exit 0 }'
$ echo $?
0

Debian's awk really cares though:

# cat /etc/debian_version
6.0.4
# awk --posix
awk: not an option: --posix
# echo $?
2

I understand the goals, but looking at the manpage on opengroup and
through one-true-awk's source, there's nothing consistent that
guarantees that POSIX is adhered to in awk (but there probably should
be a flag, environment variable, etc).

The constructs I used are simple though and should work on all variants of awk.

Thanks!
-Garrett

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents
  2012-04-04 17:31   ` Garrett Cooper
@ 2012-04-04 17:54     ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2012-04-04 17:54 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list


[-- Attachment #1.1: Type: Text/Plain, Size: 1973 bytes --]

On Wednesday 04 April 2012 13:31:10 Garrett Cooper wrote:
> On Wed, Apr 4, 2012 at 10:22 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On Wednesday 04 April 2012 01:23:43 Garrett Cooper wrote:
> >> The intent behind these changes are to remove unnecessary perl
> >> dependencies in LTP by using awk in its stead. It was something that was
> >> discussed a while ago on ltp-list@.
> > 
> > i like awk over perl a lot.  my only concern is non-POSIX stuff slipping
> > in (such as people who have gawk installed).  should we add a local
> > wrapper script that sees if the awk accepts a --posix flag and
> > automatically pass it ?
> 
> That's actually a gawk-ism :)...

yes, that's why i phrased it "if the awk accepts"

awk --help | grep -q -e --posix && args="${args} --posix"

> Seeing how Android and some other Linux distros like borrowing bits
> and pieces from BSD, I think that using --posix might not guarantee
> much (on the bright side it doesn't error out either with 'the
> one-true-awk'):

perhaps, but gawk provides a lot of useful funcs that i know i use that aren't 
in POSIX, and we want to make sure these things don't slip in.  telling people 
"make sure you test with XXX awk" is certain to be error prone.

plus, there are certain edge conditions which are very subtle.  consider the 
handling of substr() and the starting position of "0":
	echo abc | mawk '{print substr($0, 0, 2)}'  -> a
	echo abc | gawk '{print substr($0, 0, 2)}'  -> ab
	echo abc | mawk '{print substr($0, 1, 2)}'  -> ab
	echo abc | gawk '{print substr($0, 1, 2)}'  -> ab

> I understand the goals, but looking at the manpage on opengroup and
> through one-true-awk's source, there's nothing consistent that
> guarantees that POSIX is adhered to in awk (but there probably should
> be a flag, environment variable, etc).

POSIX should be the LCD we work with without accidentally using something that 
is specific to a single awk
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 274 bytes --]

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents
       [not found]     ` <201204042149.20439.vapier@gentoo.org>
@ 2012-04-06  3:34       ` Garrett Cooper
  2012-04-06 16:19         ` Caspar Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Garrett Cooper @ 2012-04-06  3:34 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: LTP list

On Wed, Apr 4, 2012 at 6:49 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Wednesday 04 April 2012 20:33:40 Garrett Cooper wrote:
>> On Wed, 4 Apr 2012, Mike Frysinger wrote:
>> > On Wednesday 04 April 2012 15:18:53 Garrett Cooper wrote:
>> >> On Wed, Apr 4, 2012 at 10:54 AM, Mike Frysinger wrote:
>> >>> On Wednesday 04 April 2012 13:31:10 Garrett Cooper wrote:
>> >>>> On Wed, Apr 4, 2012 at 10:22 AM, Mike Frysinger wrote:
>> >>>>> On Wednesday 04 April 2012 01:23:43 Garrett Cooper wrote:
>> >>>>>> The intent behind these changes are to remove unnecessary perl
>> >>>>>> dependencies in LTP by using awk in its stead. It was something that
>> >>>>>> was discussed a while ago on ltp-list@.
>> >>>>>
>> >>>>> i like awk over perl a lot.  my only concern is non-POSIX stuff
>> >>>>> slipping in (such as people who have gawk installed).  should we add
>> >>>>> a local wrapper script that sees if the awk accepts a --posix flag
>> >>>>> and automatically pass it ?
>> >>>>
>> >>>> That's actually a gawk-ism :)...
>> >>>
>> >>> yes, that's why i phrased it "if the awk accepts"
>> >>>
>> >>> awk --help | grep -q -e --posix && args="${args} --posix"
>> >>
>> >> This makes sense and it would protect against gawk'isms, but not other
>> >> *awk-isms.
>> >
>> > sure, but some protection is better than none.  if other awks have
>> > similar knobs, we can leverage them too.
>>
>> Agreed, but this should be handled in other commits, right?
>
> sure, i'm not saying let's hold up the conversion from perl.  but we should do
> it at some point imo.

    Are there any objections to the proposed [final?] patches I
submitted for this patch set?
Thanks!
-Garrett

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents
  2012-04-06  3:34       ` Garrett Cooper
@ 2012-04-06 16:19         ` Caspar Zhang
  2012-04-07  2:31           ` Wanlong Gao
  0 siblings, 1 reply; 7+ messages in thread
From: Caspar Zhang @ 2012-04-06 16:19 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP list, Mike Frysinger

On 04/06/2012 11:34 AM, Garrett Cooper wrote:
> On Wed, Apr 4, 2012 at 6:49 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> On Wednesday 04 April 2012 20:33:40 Garrett Cooper wrote:
>>> On Wed, 4 Apr 2012, Mike Frysinger wrote:
>>>> On Wednesday 04 April 2012 15:18:53 Garrett Cooper wrote:
>>>>> On Wed, Apr 4, 2012 at 10:54 AM, Mike Frysinger wrote:
>>>>>> On Wednesday 04 April 2012 13:31:10 Garrett Cooper wrote:
>>>>>>> On Wed, Apr 4, 2012 at 10:22 AM, Mike Frysinger wrote:
>>>>>>>> On Wednesday 04 April 2012 01:23:43 Garrett Cooper wrote:
>>>>>>>>> The intent behind these changes are to remove unnecessary perl
>>>>>>>>> dependencies in LTP by using awk in its stead. It was something that
>>>>>>>>> was discussed a while ago on ltp-list@.
>>>>>>>>
>>>>>>>> i like awk over perl a lot.  my only concern is non-POSIX stuff
>>>>>>>> slipping in (such as people who have gawk installed).  should we add
>>>>>>>> a local wrapper script that sees if the awk accepts a --posix flag
>>>>>>>> and automatically pass it ?
>>>>>>>
>>>>>>> That's actually a gawk-ism :)...
>>>>>>
>>>>>> yes, that's why i phrased it "if the awk accepts"
>>>>>>
>>>>>> awk --help | grep -q -e --posix && args="${args} --posix"
>>>>>
>>>>> This makes sense and it would protect against gawk'isms, but not other
>>>>> *awk-isms.
>>>>
>>>> sure, but some protection is better than none.  if other awks have
>>>> similar knobs, we can leverage them too.
>>>
>>> Agreed, but this should be handled in other commits, right?
>>
>> sure, i'm not saying let's hold up the conversion from perl.  but we should do
>> it at some point imo.
> 
>     Are there any objections to the proposed [final?] patches I
> submitted for this patch set?
> Thanks!

looks good to me.

Reviewed-by: Caspar Zhang <caspar@casparzhang.com>

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents
  2012-04-06 16:19         ` Caspar Zhang
@ 2012-04-07  2:31           ` Wanlong Gao
  0 siblings, 0 replies; 7+ messages in thread
From: Wanlong Gao @ 2012-04-07  2:31 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: Mike Frysinger, LTP list

On 04/07/2012 12:19 AM, Caspar Zhang wrote:

> On 04/06/2012 11:34 AM, Garrett Cooper wrote:
>> On Wed, Apr 4, 2012 at 6:49 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>>> On Wednesday 04 April 2012 20:33:40 Garrett Cooper wrote:
>>>> On Wed, 4 Apr 2012, Mike Frysinger wrote:
>>>>> On Wednesday 04 April 2012 15:18:53 Garrett Cooper wrote:
>>>>>> On Wed, Apr 4, 2012 at 10:54 AM, Mike Frysinger wrote:
>>>>>>> On Wednesday 04 April 2012 13:31:10 Garrett Cooper wrote:
>>>>>>>> On Wed, Apr 4, 2012 at 10:22 AM, Mike Frysinger wrote:
>>>>>>>>> On Wednesday 04 April 2012 01:23:43 Garrett Cooper wrote:
>>>>>>>>>> The intent behind these changes are to remove unnecessary perl
>>>>>>>>>> dependencies in LTP by using awk in its stead. It was something that
>>>>>>>>>> was discussed a while ago on ltp-list@.
>>>>>>>>>
>>>>>>>>> i like awk over perl a lot.  my only concern is non-POSIX stuff
>>>>>>>>> slipping in (such as people who have gawk installed).  should we add
>>>>>>>>> a local wrapper script that sees if the awk accepts a --posix flag
>>>>>>>>> and automatically pass it ?
>>>>>>>>
>>>>>>>> That's actually a gawk-ism :)...
>>>>>>>
>>>>>>> yes, that's why i phrased it "if the awk accepts"
>>>>>>>
>>>>>>> awk --help | grep -q -e --posix && args="${args} --posix"
>>>>>>
>>>>>> This makes sense and it would protect against gawk'isms, but not other
>>>>>> *awk-isms.
>>>>>
>>>>> sure, but some protection is better than none.  if other awks have
>>>>> similar knobs, we can leverage them too.
>>>>
>>>> Agreed, but this should be handled in other commits, right?
>>>
>>> sure, i'm not saying let's hold up the conversion from perl.  but we should do
>>> it at some point imo.
>>
>>     Are there any objections to the proposed [final?] patches I
>> submitted for this patch set?
>> Thanks!
> 
> looks good to me.
> 
> Reviewed-by: Caspar Zhang <caspar@casparzhang.com>


pushed, thanks all,


Wanlong Gao

> 
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 



------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-07  2:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-04  5:23 [LTP] [PATCH 0/4] Replace commonly used perl tools with awk equivalents Garrett Cooper
2012-04-04 17:22 ` Mike Frysinger
2012-04-04 17:31   ` Garrett Cooper
2012-04-04 17:54     ` Mike Frysinger
     [not found] ` <201204042028.52373.vapier@gentoo.org>
     [not found]   ` <alpine.BSF.2.00.1204041732320.25027@toaster.local>
     [not found]     ` <201204042149.20439.vapier@gentoo.org>
2012-04-06  3:34       ` Garrett Cooper
2012-04-06 16:19         ` Caspar Zhang
2012-04-07  2:31           ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox