[Fuego] [PATCH 3/4] scifab: re-write this sci test

Tim.Bird at sony.com Tim.Bird at sony.com
Mon Sep 17 22:18:40 UTC 2018


Here is the message I got applying this patch:
$ git am ~/Downloads/patches/*3_4*
Applying: scifab: re-write this sci test
/home/tbird/work/fuego/master-2018-07-10/fuego-core/.git/rebase-apply/patch:17: trailing whitespace.
#   in dmesg and /proc/interrupts 
/home/tbird/work/fuego/master-2018-07-10/fuego-core/.git/rebase-apply/patch:58: trailing whitespace.
    echo "not ok ${desc}" 
/home/tbird/work/fuego/master-2018-07-10/fuego-core/.git/rebase-apply/patch:73: trailing whitespace.
    if [ $matching_count -eq $SEARCH_COUNT ] ; then 
warning: 3 lines add whitespace errors.

I will accept this patch, but it takes time to fix these whitespace errors, so it is
slowing me down.

Can you please check for trailing whitespace before creating your patches?

You can do this with: 'grep -R " $" *' in the directory you're working in, and fix
the lines manually.

Or, another method, if you're using vim, is to add an autocmd to your .vimrc
to automatically remove whitespace from lines that you edit.

I have this line in my ~/.vimrc:
autocmd FileType sh,c,python autocmd BufWritePre <buffer> %s/\s\+$//e

This automatically removes whitespace from all line endings in shell, C, and python files
that I save from vim.

Or, a third method of dealing with this automatically is to have git check for whitespace
errors using a configuration option, or a hook.
See https://stackoverflow.com/questions/591923/make-git-automatically-remove-trailing-whitespace-before-committing#592014

As an aside, does anyone know why this is called 'scifab'?  What is the 'fab' part of this?

> -----Original Message-----
> From: Qiu Tingting
> 
> Use a similar mechanism to re-write this sci test, like Functional.arch_timer.
> And there are some modify of generalizing this sci test.
> 
> Signed-off-by: Qiu Tingting <qiutt at cn.fujitsu.com>
> ---
>  engine/tests/Functional.scifab/check_scifab.sh | 71
> ++++++++++++++++++++++++++
>  engine/tests/Functional.scifab/fuego_test.sh   | 28 +++++-----
>  2 files changed, 87 insertions(+), 12 deletions(-)
>  create mode 100755 engine/tests/Functional.scifab/check_scifab.sh
> 
> diff --git a/engine/tests/Functional.scifab/check_scifab.sh
> b/engine/tests/Functional.scifab/check_scifab.sh
> new file mode 100755
> index 0000000..2631e9c
> --- /dev/null
> +++ b/engine/tests/Functional.scifab/check_scifab.sh
> @@ -0,0 +1,71 @@
> +#!/bin/sh
> +# PDX-License-Identifier: MIT
> +#
> +# check_scifab.sh - checks for the presence of sci information
> +#   in dmesg and /proc/interrupts
> +#
> +# Usage: check_scifab.sh <dev_name> [<pattern> <count>]
> +#
> +# Output is in TAP13 format
> +#
> +# Author: Qiu Tingting <Qiutt (at) cn.fujitsu.com>
> +#
> +
> +usage() {
> +    cat <<HERE
> +Usage: check_scifab.sh [-h] <dev_name> [<pattern> <count>]
> +
> +Arguments:
> + -h  = show this usage help
> +
> +dev_name is the partial name of the interrupt in
> /proc/interrupts(eg:""sci\|serial")
> +pattern is the search pattern used for matching the initialization information
> of sci in dmesg output(eg:".*ttySC.*")
> +count is the matching count of pattern
> +HERE
> +   exit 0
> +}
> +
> +# parse arguments
> +IRQ_NAME="$1"
> +
> +if [ -z "$IRQ_NAME" -o "$IRQ_NAME" = "-h" ] ; then
> +    usage
> +fi
> +
> +echo "TAP version 13"
> +
> +echo "Test for sci attributes"
> +echo "IRQ_NAME=\"$IRQ_NAME\""
> +
> +tap_id=1
> +desc="${tap_id} Check interrupt name in proc filesystem"
> +#search partial name of sci in /proc/interrupts
> +if grep "$IRQ_NAME" /proc/interrupts ; then
> +    echo "ok ${desc}"
> +else
> +    echo "not ok ${desc}"
> +    echo "  Did not find $IRQ_NAME in /proc/interrupts"
> +fi
> +
> +SEARCH_PATTERN="$2"
> +SEARCH_COUNT="$3"
> +
> +echo "SEARCH_PATTERN=\"$SEARCH_PATTERN\""
> +echo "SEARCH_COUNT=\"$SEARCH_COUNT\""
> +
> +if [ -n "$SEARCH_PATTERN" -a -n "$SEARCH_COUNT" ] ; then
> +    tap_id=$(( $tap_id + 1 ))
> +    desc="${tap_id} Check sci initialization string in dmesg"
> +    #calculate the sci initialization string count in dmesg output
> +    matching_count=`dmesg | grep "$SEARCH_PATTERN" | wc -l`
> +    if [ $matching_count -eq $SEARCH_COUNT ] ; then
> +        echo "ok ${desc}"
> +    else
> +        echo "not ok ${desc}"
> +        echo "  the matching count for '$SEARCH_PATTERN' is not as
> expected,expected count is '$SEARCH_COUNT',reality is '$matching_count'"
> +    fi
> +else
> +    echo "Pattern or count is not defined. This case is skipped."
> +fi
> +
> +echo "1..$tap_id"
> diff --git a/engine/tests/Functional.scifab/fuego_test.sh
> b/engine/tests/Functional.scifab/fuego_test.sh
> index 418e947..bc8e28f 100755
> --- a/engine/tests/Functional.scifab/fuego_test.sh
> +++ b/engine/tests/Functional.scifab/fuego_test.sh
> @@ -1,21 +1,25 @@
> -tarball=dung-3.4.25-m2.tar.gz
> +#
> +# user must define in the board file:
> +#  SCIFAB_NAME = the partial name in /proc/interrupts for the sci(serial
> communication interface) interrupt
> +# Optionally, the user MAY define in the board file:
> +#  SCIFAB_PATTERN = a search pattern used for matching initialization
> information of the sci in dmesg output
> +#  SCIFAB_COUNT = the matching count of SCIFAB_PATTERN in dmesg
> +#
I reworded these slightly, and line-wrapped them.  It would be much
better to put these into a test.yaml file for this test.  That is where
we try to keep per-test documentation and meta-information.
Specifically, we like to note test variables and required board variables
in the test.yaml file.

> +
> +function test_pre_check {
> +    assert_define SCIFAB_NAME "Please define in board file as partial name
> of sci interrupt"
I'm unfamiliar with the 'sci' acronym.  I'm going to make this more verbose
by replacing 'sci' in this diagnostic message with 'serial communication interface (sci)'
> +
> +}
> 
>  function test_deploy {
> -    put ./* $OSV_HOME/osv.$TESTDIR/
Thank you very much for cleaning up this test, which was still using super-old JTA conventions.

> +    put $TEST_HOME/check_scifab.sh $BOARD_TESTDIR/fuego.$TESTDIR/
>  }
> 
>  function test_run {
> -    report "cd $OSV_HOME/osv.$TESTDIR/scifab; ./dmesg-sh-sci.0.sh; ./proc-
> interrupts.sh"
> +    report "$BOARD_TESTDIR/fuego.$TESTDIR/check_scifab.sh \
> +        \"$SCIFAB_NAME\" \"$SCIFAB_PATTERN\" \"$SCIFAB_COUNT\""
>  }
> 
>  function test_processing {
> -    assert_define FUNCTIONAL_SCIFAB_RES_LINES_COUNT
> -    assert_define FUNCTIONAL_SCIFAB_RES_PASS_COUNT
> -    assert_define FUNCTIONAL_SCIFAB_RES_FAIL_COUNT
> -
> -    check_capability "RENESAS"
> -
> -    log_compare "$TESTDIR" $FUNCTIONAL_SCIFAB_RES_LINES_COUNT
> "Passed:$FUNCTIONAL_SCIFAB_RES_PASS_COUNT
> Failed:$FUNCTIONAL_SCIFAB_RES_FAIL_COUNT" "p"
> +    log_compare "$TESTDIR" 0 "^not ok" "n"
>  }
> -
> -
> --
> 2.7.4

Thanks!  Applied, with some changes as mentioned.  It would be nice if you could
follow up with another patch to move some of the test variable information into
a test.yaml file for this test.  See arch_timer for an example.

 -- Tim



More information about the Fuego mailing list