diff mbox series

[BLKTESTS,3/3] nvme/017: fix output format

Message ID 1550516022-16374-4-git-send-email-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series nvme: fix output formats | expand

Commit Message

Chaitanya Kulkarni Feb. 18, 2019, 6:53 p.m. UTC
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 tests/nvme/017     |  5 ++++-
 tests/nvme/017.out | 11 -----------
 2 files changed, 4 insertions(+), 12 deletions(-)

Comments

Bart Van Assche Feb. 19, 2019, 4:17 p.m. UTC | #1
On Mon, 2019-02-18 at 10:53 -0800, Chaitanya Kulkarni wrote:
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  tests/nvme/017     |  5 ++++-
>  tests/nvme/017.out | 11 -----------
>  2 files changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/nvme/017 b/tests/nvme/017
> index 0b86bec..db87759 100755
> --- a/tests/nvme/017
> +++ b/tests/nvme/017
> @@ -37,7 +37,10 @@ test() {
>  	port="$(_create_nvmet_port "loop")"
>  	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
>  
> -	nvme discover -t loop | sed -r -e "s/portid:  [0-9]+/portid:  X/"
> +	nvme discover -t loop | grep -q "${subsys_nqn}"
> +	if [ $? -ne 0 ]; then
> +		echo "nvme discover command failed"
> +	fi

Hi Chaitanya,

Please keep the code style consistent with other blktests code and write that
if-condition as follows:

	if ! nvme discover -t loop | grep -q "${subsys_nqn}"; then
		echo "nvme discover command failed"
	fi

Thanks,

Bart.
Chaitanya Kulkarni Feb. 19, 2019, 8:06 p.m. UTC | #2
On 02/19/2019 08:17 AM, Bart Van Assche wrote:
> On Mon, 2019-02-18 at 10:53 -0800, Chaitanya Kulkarni wrote:
>> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
>> ---
>>   tests/nvme/017     |  5 ++++-
>>   tests/nvme/017.out | 11 -----------
>>   2 files changed, 4 insertions(+), 12 deletions(-)
>>
>> diff --git a/tests/nvme/017 b/tests/nvme/017
>> index 0b86bec..db87759 100755
>> --- a/tests/nvme/017
>> +++ b/tests/nvme/017
>> @@ -37,7 +37,10 @@ test() {
>>   	port="$(_create_nvmet_port "loop")"
>>   	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
>>
>> -	nvme discover -t loop | sed -r -e "s/portid:  [0-9]+/portid:  X/"
>> +	nvme discover -t loop | grep -q "${subsys_nqn}"
>> +	if [ $? -ne 0 ]; then
>> +		echo "nvme discover command failed"
>> +	fi
>
> Hi Chaitanya,
>
> Please keep the code style consistent with other blktests code and write that
> if-condition as follows:
>
> 	if ! nvme discover -t loop | grep -q "${subsys_nqn}"; then
> 		echo "nvme discover command failed"
> 	fi
>
> Thanks,
>
> Bart.
>

Sounds good, will send out new revision.
diff mbox series

Patch

diff --git a/tests/nvme/017 b/tests/nvme/017
index 0b86bec..db87759 100755
--- a/tests/nvme/017
+++ b/tests/nvme/017
@@ -37,7 +37,10 @@  test() {
 	port="$(_create_nvmet_port "loop")"
 	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
 
-	nvme discover -t loop | sed -r -e "s/portid:  [0-9]+/portid:  X/"
+	nvme discover -t loop | grep -q "${subsys_nqn}"
+	if [ $? -ne 0 ]; then
+		echo "nvme discover command failed"
+	fi
 	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
 	_remove_nvmet_port "${port}"
 
diff --git a/tests/nvme/017.out b/tests/nvme/017.out
index 4b0877a..6ce9a80 100644
--- a/tests/nvme/017.out
+++ b/tests/nvme/017.out
@@ -1,13 +1,2 @@ 
 Running nvme/017
-
-Discovery Log Number of Records 1, Generation counter 1
-=====Discovery Log Entry 0======
-trtype:  loop
-adrfam:  pci
-subtype: nvme subsystem
-treq:    not specified
-portid:  X
-trsvcid: 
-subnqn:  blktests-subsystem-1
-traddr:  
 Test complete