* [LTP] [PATCH] run_memctl_test.sh: replace the former intercept method
@ 2014-08-07 9:50 Xing Gu
2014-08-13 10:21 ` Jan Stancek
0 siblings, 1 reply; 4+ messages in thread
From: Xing Gu @ 2014-08-07 9:50 UTC (permalink / raw)
To: ltp-list
In RHEL6.5GA and RHEL7.0GA, running run_memctl_test.sh outputs
"/opt/ltp/testcases/bin/run_memctl_test.sh: line 87: [: -lt:
unary operator expected" error. This is because $MEM_AVAIL
is empty here, which is caused by command "tr -s [:space:]" that
loses efficacy. Using "awk" replaces the former intercept method.
Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
---
testcases/kernel/controllers/memctl/run_memctl_test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/controllers/memctl/run_memctl_test.sh b/testcases/kernel/controllers/memctl/run_memctl_test.sh
index 66e8f4f..fe171df 100755
--- a/testcases/kernel/controllers/memctl/run_memctl_test.sh
+++ b/testcases/kernel/controllers/memctl/run_memctl_test.sh
@@ -83,7 +83,7 @@ cd $LTPROOT/testcases/bin/
#################################################################################
# First of all check if the system has sufficient memory
-MEM_AVAIL=`cat /proc/meminfo | grep MemTotal | tr -s [:space:] | cut -d" " -f2`;
+MEM_AVAIL=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`;
if [ $MEM_AVAIL -lt 262144 ] # 256MB(as test requires some ~200MB)
then
echo System does not have sufficient free memory.;
--
1.9.3
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] run_memctl_test.sh: replace the former intercept method
2014-08-07 9:50 [LTP] [PATCH] run_memctl_test.sh: replace the former intercept method Xing Gu
@ 2014-08-13 10:21 ` Jan Stancek
2014-08-18 7:35 ` gux.fnst
2014-10-15 11:45 ` Cyril Hrubis
0 siblings, 2 replies; 4+ messages in thread
From: Jan Stancek @ 2014-08-13 10:21 UTC (permalink / raw)
To: Xing Gu; +Cc: ltp-list
----- Original Message -----
> From: "Xing Gu" <gux.fnst@cn.fujitsu.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Thursday, 7 August, 2014 11:50:10 AM
> Subject: [LTP] [PATCH] run_memctl_test.sh: replace the former intercept method
>
> In RHEL6.5GA and RHEL7.0GA, running run_memctl_test.sh outputs
> "/opt/ltp/testcases/bin/run_memctl_test.sh: line 87: [: -lt:
> unary operator expected" error. This is because $MEM_AVAIL
> is empty here, which is caused by command "tr -s [:space:]" that
> loses efficacy. Using "awk" replaces the former intercept method.
Hi,
or you could put quotes around it:
tr -s "[:space:]"
so it's not evaluated as wildcard:
# cd /opt/ltp/
# echo [:space:]
[:space:]
# cd testcases/bin/
# echo [:space:]
c
# ls -al c
-rwxrwxr-x. 1 root root 11251 Jul 30 02:20 c
If you're wondering where that "c" comes from:
./testcases/kernel/security/filecaps/c.c
I'm OK with using awk, though commit message could be more clear.
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Regards,
Jan
>
> Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
> ---
> testcases/kernel/controllers/memctl/run_memctl_test.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/controllers/memctl/run_memctl_test.sh
> b/testcases/kernel/controllers/memctl/run_memctl_test.sh
> index 66e8f4f..fe171df 100755
> --- a/testcases/kernel/controllers/memctl/run_memctl_test.sh
> +++ b/testcases/kernel/controllers/memctl/run_memctl_test.sh
> @@ -83,7 +83,7 @@ cd $LTPROOT/testcases/bin/
> #################################################################################
>
> # First of all check if the system has sufficient memory
> -MEM_AVAIL=`cat /proc/meminfo | grep MemTotal | tr -s [:space:] | cut -d" "
> -f2`;
> +MEM_AVAIL=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`;
> if [ $MEM_AVAIL -lt 262144 ] # 256MB(as test requires some ~200MB)
> then
> echo System does not have sufficient free memory.;
> --
> 1.9.3
>
>
> ------------------------------------------------------------------------------
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] run_memctl_test.sh: replace the former intercept method
2014-08-13 10:21 ` Jan Stancek
@ 2014-08-18 7:35 ` gux.fnst
2014-10-15 11:45 ` Cyril Hrubis
1 sibling, 0 replies; 4+ messages in thread
From: gux.fnst @ 2014-08-18 7:35 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
On 08/13/2014 06:21 PM, Jan Stancek wrote:
>
>
> ----- Original Message -----
>> From: "Xing Gu" <gux.fnst@cn.fujitsu.com>
>> To: ltp-list@lists.sourceforge.net
>> Sent: Thursday, 7 August, 2014 11:50:10 AM
>> Subject: [LTP] [PATCH] run_memctl_test.sh: replace the former intercept method
>>
>> In RHEL6.5GA and RHEL7.0GA, running run_memctl_test.sh outputs
>> "/opt/ltp/testcases/bin/run_memctl_test.sh: line 87: [: -lt:
>> unary operator expected" error. This is because $MEM_AVAIL
>> is empty here, which is caused by command "tr -s [:space:]" that
>> loses efficacy. Using "awk" replaces the former intercept method.
>
> Hi,
>
> or you could put quotes around it:
> tr -s "[:space:]"
>
> so it's not evaluated as wildcard:
> # cd /opt/ltp/
> # echo [:space:]
> [:space:]
>
> # cd testcases/bin/
> # echo [:space:]
> c
>
> # ls -al c
> -rwxrwxr-x. 1 root root 11251 Jul 30 02:20 c
>
> If you're wondering where that "c" comes from:
> ./testcases/kernel/security/filecaps/c.c
>
> I'm OK with using awk, though commit message could be more clear.
>
I see. Thanks for your review.
Regards,
Xing Gu
> Reviewed-by: Jan Stancek <jstancek@redhat.com>
>
> Regards,
> Jan
>
>>
>> Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
>> ---
>> testcases/kernel/controllers/memctl/run_memctl_test.sh | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/testcases/kernel/controllers/memctl/run_memctl_test.sh
>> b/testcases/kernel/controllers/memctl/run_memctl_test.sh
>> index 66e8f4f..fe171df 100755
>> --- a/testcases/kernel/controllers/memctl/run_memctl_test.sh
>> +++ b/testcases/kernel/controllers/memctl/run_memctl_test.sh
>> @@ -83,7 +83,7 @@ cd $LTPROOT/testcases/bin/
>> #################################################################################
>>
>> # First of all check if the system has sufficient memory
>> -MEM_AVAIL=`cat /proc/meminfo | grep MemTotal | tr -s [:space:] | cut -d" "
>> -f2`;
>> +MEM_AVAIL=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`;
>> if [ $MEM_AVAIL -lt 262144 ] # 256MB(as test requires some ~200MB)
>> then
>> echo System does not have sufficient free memory.;
>> --
>> 1.9.3
>>
>>
>> ------------------------------------------------------------------------------
>> Infragistics Professional
>> Build stunning WinForms apps today!
>> Reboot your WinForms applications with our WinForms controls.
>> Build a bridge from your legacy apps to the future.
>> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>>
> .
>
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] run_memctl_test.sh: replace the former intercept method
2014-08-13 10:21 ` Jan Stancek
2014-08-18 7:35 ` gux.fnst
@ 2014-10-15 11:45 ` Cyril Hrubis
1 sibling, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2014-10-15 11:45 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> I'm OK with using awk, though commit message could be more clear.
>
> Reviewed-by: Jan Stancek <jstancek@redhat.com>
I've updated the commit message and pushed the patch, thanks to both of
you.
PS: Jan you should have pushed this patch allready.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-15 11:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-07 9:50 [LTP] [PATCH] run_memctl_test.sh: replace the former intercept method Xing Gu
2014-08-13 10:21 ` Jan Stancek
2014-08-18 7:35 ` gux.fnst
2014-10-15 11:45 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox