public inbox for [email protected]
 help / color / mirror / Atom feed
From: Hao Xu <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected], Joseph Qi <[email protected]>
Subject: Re: [PATCH liburing] test: use a map to define test files / devices we need
Date: Tue, 22 Dec 2020 11:03:17 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

在 2020/12/15 上午10:44, Hao Xu 写道:
> 在 2020/12/8 下午8:28, Hao Xu 写道:
> ping...
Hi Jens,
I'm currently develop a test which need a device arg, so I
leverage TEST_FILES, I found it may be better to form
TEST_FILES as a key-value structure.
Thanks && Regards,
Hao
>> Different tests need different files / devices, use a map to indicate
>> what each test need.
>>
>> Signed-off-by: Hao Xu <[email protected]>
>> ---
>>
>> the former implementation use a array for the global list TEST_FILES,
>> which may causes this:
>>     TEST_FILES="dev0 dev1"
>>     dev0 required by test0
>>     dev1 required by test1
>> In the <for tst in $TESTS> loop, we run the test for each $dev, which
>> makes <test0 dev1> and <test1 dev0> run, these are not expected.
>> Currently I see that statx.c accept argv[1] as a file_name, if someone
>> writes another test which defines a device(say nvme0n1) in TEST_FILES,
>> it may cause issues.
>>
>>   test/config      |  2 +-
>>   test/runtests.sh | 13 ++++++-------
>>   2 files changed, 7 insertions(+), 8 deletions(-)
>>
>> diff --git a/test/config b/test/config
>> index cab270359155..1bd9b40207bb 100644
>> --- a/test/config
>> +++ b/test/config
>> @@ -4,4 +4,4 @@
>>   # TEST_EXCLUDE=""
>>   #
>>   # Define raw test devices (or files) for test cases, if any
>> -# TEST_FILES="/dev/nvme0n1p2 /data/file"
>> +# declare -A TEST_FILES=()
>> diff --git a/test/runtests.sh b/test/runtests.sh
>> index fa240f205542..1a6905b42768 100755
>> --- a/test/runtests.sh
>> +++ b/test/runtests.sh
>> @@ -5,10 +5,10 @@ RET=0
>>   TIMEOUT=60
>>   DMESG_FILTER="cat"
>>   TEST_DIR=$(dirname $0)
>> -TEST_FILES=""
>>   FAILED=""
>>   SKIPPED=""
>>   MAYBE_FAILED=""
>> +declare -A TEST_FILES
>>   # Only use /dev/kmsg if running as root
>>   DO_KMSG="1"
>> @@ -17,7 +17,7 @@ DO_KMSG="1"
>>   # Include config.local if exists and check TEST_FILES for valid devices
>>   if [ -f "$TEST_DIR/config.local" ]; then
>>       . $TEST_DIR/config.local
>> -    for dev in $TEST_FILES; do
>> +    for dev in ${TEST_FILES[@]}; do
>>           if [ ! -e "$dev" ]; then
>>               echo "Test file $dev not valid"
>>               exit 1
>> @@ -109,11 +109,10 @@ run_test()
>>   # Run all specified tests
>>   for tst in $TESTS; do
>> -    run_test $tst
>> -    if [ ! -z "$TEST_FILES" ]; then
>> -        for dev in $TEST_FILES; do
>> -            run_test $tst $dev
>> -        done
>> +    if [ ! -n "${TEST_FILES[$tst]}" ]; then
>> +        run_test $tst
>> +    else
>> +        run_test $tst ${TEST_FILES[$tst]}
>>       fi
>>   done
>>


  reply	other threads:[~2020-12-22  3:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 12:28 [PATCH liburing] test: use a map to define test files / devices we need Hao Xu
2020-12-15  2:44 ` Hao Xu
2020-12-22  3:03   ` Hao Xu [this message]
2021-01-26  6:18     ` Hao Xu
2021-01-26 17:59       ` Jens Axboe
2021-01-27 12:04         ` Hao Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87b3001f-0984-3890-269b-1a069704e374@linux.alibaba.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox