You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@yetus.apache.org by "Allen Wittenauer (JIRA)" <ji...@apache.org> on 2017/05/26 01:28:05 UTC

[jira] [Commented] (YETUS-466) yetus_verify_entry returns wrong result when test at start or end of NEEDED_TESTS String

    [ https://issues.apache.org/jira/browse/YETUS-466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16025643#comment-16025643 ] 

Allen Wittenauer commented on YETUS-466:
----------------------------------------

yetus_verify_entry is used against vars that are built with yetus_add_entry.  When yetus_add_entry is used, this pattern emerges:

{code}+ yetus_add_entry x a
+ [[ ! '' =~  a  ]]
+ eval 'x=" a "'
++ x=' a '
+ yetus_verify_entry x a
+ [[  a  =~  a  ]]
+ echo 0
+ yetus_add_entry x b
+ [[ !  a  =~  b  ]]
+ eval 'x=" a  b "'
++ x=' a  b '
+ yetus_verify_entry x a
+ [[  a  b  =~  a  ]]
+ echo 0
+ yetus_add_entry x c
+ [[ !  a  b  =~  c  ]]
+ eval 'x=" a  b  c "'
++ x=' a  b  c '
+ yetus_verify_entry x a
+ [[  a  b  c  =~  a  ]]
+ echo 0
{code}

Using your example:
{code}
+ yetus_add_entry x asflicense
+ [[ ! '' =~  asflicense  ]]
+ eval 'x=" asflicense "'
++ x=' asflicense '
+ yetus_verify_entry x asflicense
+ [[  asflicense  =~  asflicense  ]]
+ echo 0
+ yetus_add_entry x cc
+ [[ !  asflicense  =~  cc  ]]
+ eval 'x=" asflicense  cc "'
++ x=' asflicense  cc '
+ yetus_verify_entry x cc
+ [[  asflicense  cc  =~  cc  ]]
+ echo 0
+ yetus_add_entry x unit
+ [[ !  asflicense  cc  =~  unit  ]]
+ eval 'x=" asflicense  cc  unit "'
++ x=' asflicense  cc  unit '
+ yetus_verify_entry x unit
+ [[  asflicense  cc  unit  =~  unit  ]]
+ echo 0
+ yetus_add_entry x hbaseprotoc
+ [[ !  asflicense  cc  unit  =~  hbaseprotoc  ]]
+ eval 'x=" asflicense  cc  unit  hbaseprotoc "'
++ x=' asflicense  cc  unit  hbaseprotoc '
+ yetus_verify_entry x hbaseprotoc
+ [[  asflicense  cc  unit  hbaseprotoc  =~  hbaseprotoc  ]]
+ echo 0
{code}

The key is here:

{code}
x=' asflicense  cc  unit  hbaseprotoc '
{code}

There is always a leading space in the generated environment variable, which means that the test that yetus_verify_entry uses should then work.

Long term, all of these should get converted to arrays so we don't have to play games with spacing.  

> yetus_verify_entry returns wrong result when test at start or end of NEEDED_TESTS String
> ----------------------------------------------------------------------------------------
>
>                 Key: YETUS-466
>                 URL: https://issues.apache.org/jira/browse/YETUS-466
>             Project: Yetus
>          Issue Type: Bug
>          Components: Test Patch
>            Reporter: stack
>
> I noticed this when a test that is claimed needed:
> {code}
> [Fri Oct 28 11:46:58 PDT 2016 DEBUG]: Adding hbaseprotoc to NEEDED_TESTS
> {code}
> ... but then a a later call to verify_needed_test was claiming the test was not needed (digging, its whether test is in the NEEDED_TESTS list... which it is in my case... just the last one on the list).
> Illustration after defining yetus_verify_entry in my local shell:
> {code}
> kalashnikov:precommit stack$ x="asflicense  cc  unit  hbaseprotoc "
> kalashnikov:precommit stack$ yetus_verify_entry x asflicense
> kalashnikov:precommit stack$ echo $?
> 1
> kalashnikov:precommit stack$ x="xxx asflicense  cc  unit  hbaseprotoc "
> kalashnikov:precommit stack$ yetus_verify_entry x asflicense
> kalashnikov:precommit stack$ echo $?
> 0
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)