On 11/06/2018 09:34 AM, Paul Durrant wrote:
>> +# Example input:
>> +# Uid:      1193    1193    1193    1193
>> +input=$(grep ^Uid: /proc/$dmpid/status)
>> +if [[ "$input" =~ ^Uid:[[:space:]]+([0-9]+)[[:space:]]+([0-
>> 9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)$ ]] ; then
>> +    result="PASSED"
>> +    for i in {1..4}; do
>> +    if [[ "${BASH_REMATCH[$i]}" != "$tgt_uid" ]] ; then
>> +        result="FAILED"
>> +        failed="true"
> 
> This patter occurs many times. Could you not just have a boolean 'failed' 
> value and a supporting 'reason' (which might be empty) then you can just test 
> 'reason' at the end to decide what to echo?

Yes, Ian also suggested that, and if I end up leaving it as a bash
script I'll certainly do something like that.  However:

>> NB this patch is included for reference only, while I consider whether
>> to leave this as a stand-alone script, or whether to merge osstest's
>> fd checker functionality into it (perhaps changing the language to
>> perl at the same time).  Reviews of the general detection algorithm
>> are welcome, but there's no need for a detailed review of the code
>> until the script is in its final form.

Sorry you missed that!  If I end up leaving this as a bash script I'll
take your comments about tabs/spaces and the value of "failed" into account.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to