diff mbox series

[iproute2] testsuite: ss: Fix spacing in expected output for ssfilter.t

Message ID d50e870d746ecb30f1ace3af40db2a249da6b4c2.1541841383.git.sbrivio@redhat.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show
Series [iproute2] testsuite: ss: Fix spacing in expected output for ssfilter.t | expand

Commit Message

Stefano Brivio Nov. 10, 2018, 9:21 a.m. UTC
Since commit 00240899ec0b ("ss: Actually print left delimiter for
columns") changes spacing in ss output, we also need to adjust for that in
the ss filter test.

Fixes: 00240899ec0b ("ss: Actually print left delimiter for columns")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 testsuite/tests/ss/ssfilter.t | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Phil Sutter Nov. 10, 2018, 9:48 p.m. UTC | #1
Hi Stefano,

On Sat, Nov 10, 2018 at 10:21:59AM +0100, Stefano Brivio wrote:
> Since commit 00240899ec0b ("ss: Actually print left delimiter for
> columns") changes spacing in ss output, we also need to adjust for that in
> the ss filter test.
> 
> Fixes: 00240899ec0b ("ss: Actually print left delimiter for columns")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> ---
>  testsuite/tests/ss/ssfilter.t | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/testsuite/tests/ss/ssfilter.t b/testsuite/tests/ss/ssfilter.t
> index e74f1765cb72..3091054f2892 100755
> --- a/testsuite/tests/ss/ssfilter.t
> +++ b/testsuite/tests/ss/ssfilter.t
> @@ -12,37 +12,37 @@ export TCPDIAG_FILE="$(dirname $0)/ss1.dump"
>  ts_log "[Testing ssfilter]"
>  
>  ts_ss "$0" "Match dport = 22" -Htna dport = 22
> -test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
> +test_on "ESTAB     0           0                10.0.0.1:36266           10.0.0.1:22"

How about using a regular expression ('test_on' calls grep with '-E')?
E.g. this instead of the above:

| test_on "ESTAB *0 *0 *10.0.0.1:36266 *10.0.0.1:22"

Note that I didn't test this change, just made sure 'grep -E' recognizes
' *' as expected.

Cheers, Phil
Stefano Brivio Nov. 11, 2018, 11:50 a.m. UTC | #2
Hi Phil,

On Sat, 10 Nov 2018 22:48:44 +0100
Phil Sutter <phil@nwl.cc> wrote:

> On Sat, Nov 10, 2018 at 10:21:59AM +0100, Stefano Brivio wrote:
>
> > @@ -12,37 +12,37 @@ export TCPDIAG_FILE="$(dirname $0)/ss1.dump"
> >  ts_log "[Testing ssfilter]"
> >  
> >  ts_ss "$0" "Match dport = 22" -Htna dport = 22
> > -test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
> > +test_on "ESTAB     0           0                10.0.0.1:36266           10.0.0.1:22"  
> 
> How about using a regular expression ('test_on' calls grep with '-E')?
> E.g. this instead of the above:
> 
> | test_on "ESTAB *0 *0 *10.0.0.1:36266 *10.0.0.1:22"

I also thought about something similar (perhaps uglier: piping the
output through tr -s ' ' in ts_ss()).

But then I thought we might like to use this test to also check that we
don't accidentally modify spacing, so I'd rather leave it as it is,
with this patch on top.
Phil Sutter Nov. 11, 2018, 12:12 p.m. UTC | #3
Hi Stefano,

On Sun, Nov 11, 2018 at 12:50:39PM +0100, Stefano Brivio wrote:
> On Sat, 10 Nov 2018 22:48:44 +0100
> Phil Sutter <phil@nwl.cc> wrote:
> 
> > On Sat, Nov 10, 2018 at 10:21:59AM +0100, Stefano Brivio wrote:
> >
> > > @@ -12,37 +12,37 @@ export TCPDIAG_FILE="$(dirname $0)/ss1.dump"
> > >  ts_log "[Testing ssfilter]"
> > >  
> > >  ts_ss "$0" "Match dport = 22" -Htna dport = 22
> > > -test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
> > > +test_on "ESTAB     0           0                10.0.0.1:36266           10.0.0.1:22"  
> > 
> > How about using a regular expression ('test_on' calls grep with '-E')?
> > E.g. this instead of the above:
> > 
> > | test_on "ESTAB *0 *0 *10.0.0.1:36266 *10.0.0.1:22"
> 
> I also thought about something similar (perhaps uglier: piping the
> output through tr -s ' ' in ts_ss()).
> 
> But then I thought we might like to use this test to also check that we
> don't accidentally modify spacing, so I'd rather leave it as it is,
> with this patch on top.

Fair enough, no objections from my side.

Thanks, Phil
Stephen Hemminger Nov. 12, 2018, 4:41 p.m. UTC | #4
On Sat, 10 Nov 2018 22:48:44 +0100
Phil Sutter <phil@nwl.cc> wrote:

> Hi Stefano,
> 
> On Sat, Nov 10, 2018 at 10:21:59AM +0100, Stefano Brivio wrote:
> > Since commit 00240899ec0b ("ss: Actually print left delimiter for
> > columns") changes spacing in ss output, we also need to adjust for that in
> > the ss filter test.
> > 
> > Fixes: 00240899ec0b ("ss: Actually print left delimiter for columns")
> > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/testsuite/tests/ss/ssfilter.t b/testsuite/tests/ss/ssfilter.t
index e74f1765cb72..3091054f2892 100755
--- a/testsuite/tests/ss/ssfilter.t
+++ b/testsuite/tests/ss/ssfilter.t
@@ -12,37 +12,37 @@  export TCPDIAG_FILE="$(dirname $0)/ss1.dump"
 ts_log "[Testing ssfilter]"
 
 ts_ss "$0" "Match dport = 22" -Htna dport = 22
-test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
+test_on "ESTAB     0           0                10.0.0.1:36266           10.0.0.1:22"
 
 ts_ss "$0" "Match dport 22" -Htna dport 22
-test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
+test_on "ESTAB     0           0                10.0.0.1:36266           10.0.0.1:22"
 
 ts_ss "$0" "Match (dport)" -Htna '( dport = 22 )'
-test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
+test_on "ESTAB     0           0                10.0.0.1:36266           10.0.0.1:22"
 
 ts_ss "$0" "Match src = 0.0.0.0" -Htna src = 0.0.0.0
-test_on "LISTEN     0           128                0.0.0.0:22             0.0.0.0:*"
+test_on "LISTEN      0           128               0.0.0.0:22             0.0.0.0:*"
 
 ts_ss "$0" "Match src 0.0.0.0" -Htna src 0.0.0.0
-test_on "LISTEN     0           128                0.0.0.0:22             0.0.0.0:*"
+test_on "LISTEN      0           128               0.0.0.0:22             0.0.0.0:*"
 
 ts_ss "$0" "Match src sport" -Htna src 0.0.0.0 sport = 22
-test_on "LISTEN     0           128                0.0.0.0:22             0.0.0.0:*"
+test_on "LISTEN      0           128               0.0.0.0:22             0.0.0.0:*"
 
 ts_ss "$0" "Match src and sport" -Htna src 0.0.0.0 and sport = 22
-test_on "LISTEN     0           128                0.0.0.0:22             0.0.0.0:*"
+test_on "LISTEN      0           128               0.0.0.0:22             0.0.0.0:*"
 
 ts_ss "$0" "Match src and sport and dport" -Htna src 10.0.0.1 and sport = 22 and dport = 50312
-test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+test_on "ESTAB     0           0                10.0.0.1:22           10.0.0.2:50312"
 
 ts_ss "$0" "Match src and sport and (dport)" -Htna 'src 10.0.0.1 and sport = 22 and ( dport = 50312 )'
-test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+test_on "ESTAB     0           0                10.0.0.1:22           10.0.0.2:50312"
 
 ts_ss "$0" "Match src and (sport and dport)" -Htna 'src 10.0.0.1 and ( sport = 22 and dport = 50312 )'
-test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+test_on "ESTAB     0           0                10.0.0.1:22           10.0.0.2:50312"
 
 ts_ss "$0" "Match (src and sport) and dport" -Htna '( src 10.0.0.1 and sport = 22 ) and dport = 50312'
-test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+test_on "ESTAB     0           0                10.0.0.1:22           10.0.0.2:50312"
 
 ts_ss "$0" "Match (src or src) and dst" -Htna '( src 0.0.0.0 or src 10.0.0.1 ) and dst 10.0.0.2'
-test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+test_on "ESTAB     0           0                10.0.0.1:22           10.0.0.2:50312"