Added tests to check the reported SCSI vendor, revision, model and type

This commit is contained in:
akuker 2020-09-04 22:29:33 -05:00
parent aaf41522a5
commit 70fa5ce60a
4 changed files with 165 additions and 36 deletions

4
test/robot/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
log.html
output.xml
report.html

View File

@ -1,6 +1,8 @@
*** Settings ***
Library SSHLibrary
Library Process
Library String
Resource linux_services.resource
*** Variables ***
@ -17,48 +19,92 @@ ${Scsi_device_type_processor} 3
${Scsi_device_type_write_once_dev} 4
${Scsi_device_type_cd_rom} 5
${Scsi_device_type_scanner} 6
${Scsi_device_type_optical_memory} 7
*** Keywords ***
Open Connection to Rascsi and Log In
Open Connection ${Rascsi_Host}
Login ${Rascsi_Username} ${Rascsi_Password}
Create Blank Rascsi Drive Image of Size ${drive_size} kilobytes named ${file_name}
Create Blank Rascsi Drive Image of Size ${drive_size} megabytes named ${file_name}
[Documentation] Creates an empty drive image on the Rascsi host of the specified size and file name
Execute Command dd if=/dev/zero of=/home/pi/images/${file_name} block_size=1k count=${drive_size}
Execute Command dd if=/dev/zero of=/home/pi/images/${file_name} bs=1M count=${drive_size}
Attach drive image ${drive_image_file} as ID ${scsi_id}
[Documentation] Attaches an existing drive image to the RaSCSI
Execute Command rasctl -i ${scsi_id} -c attach -f /home/pi/images/${drive_image_file}
Delete drive image ${file_name}
[Documentation] Delete a disk drive image that was created on the raspberry pi
Execute Command rm /home/pi/images/${file_name}
Rasctl reports SCSI ID ${scsi_id} of type ${type:CD|MO|HD}
[Documentation] Executes rasctl and verifies that the drive is configured as the specified type
Drive image ${drive_image_file} is attached as SCSI ID ${scsi_id}
[Documentation] Attaches an existing drive image to the RaSCSI
${rasctl_output}= Execute Command rasctl -i ${scsi_id} -c attach -f /home/pi/images/${drive_image_file}
log ${rasctl_output}
${rasctl_output}= Execute Command rasctl -l
log ${rasctl_output}
Rescan SCSI Bus
CD-ROM drive is attached as SCSI ID ${scsi_id}
[Documentation] Attaches a CD-ROM device (without any media) to the RaSCSI
${rasctl_output}= Execute Command rasctl -i ${scsi_id} -c attach -t cd
log ${rasctl_output}
${rasctl_output}= Execute Command rasctl -l
log ${rasctl_output}
Rescan SCSI Bus
Magneto Optical drive is attached as SCSI ID ${scsi_id}
[Documentation] Attaches a Magneto Optical device (without any media) to the RaSCSI
Execute Command rasctl -i ${scsi_id} -c attach -t mo
${rasctl_output}= Execute Command rasctl -l
log ${rasctl_output}
Rescan SCSI Bus
Detach all SCSI Devices
[Documentation] Send detach commands for all of the SCSI IDs to make sure that there
... aren't any left over before/after a test
FOR ${scsi_id} IN RANGE 1 7
Detach SCSI ID ${scsi_id}
END
Detach SCSI ID ${scsi_id:\d+}
[Documentation] Detaches the specified SCSI ID from Rascsi
Execute Command rasctl -c detach -i ${scsi_id}
Rescan SCSI Bus
[Documentation] Commands Linux to re-scan the SCSI bus on the local host
${result}= Run Process sudo bash -c "echo \"- - -\" > /sys/class/scsi_host/host0/scan" shell=True
Rasctl reports SCSI ID ${scsi_id} of type ${type:CD|MO|HD}
[Documentation] Executes rasctl and verifies that the drive is configured as the specified type
${rasctl_output}= Execute Command rasctl -l
log ${rasctl_output}
Should Contain ${rasctl_output} |${SPACE*2}${scsi_id}${SPACE}|${SPACE*2}0${SPACE}|${SPACE}SC${type}${SPACE}|
SCSI ID ${scsi_id} reports vendor ${scsi_vendor}
[Documentation] Reads the SCSI vendor from sysfs and checks that it matches expected value
${read_scsi_vendor}= Get File /sys/class/scsi_device/0:0:${scsi_id}:0/device/vendor
Log Vendor ID read from sysfs was ${read_scsi_vendor}
Should Be Equal ${read_scsi_vendor} ${scsi_vendor} Incorrect SCSI vendor reported for ID ${scsi_id}
[Documentation] Reads the SCSI vendor from sysfs and checks that it matches expected value
# Sleep 2 minutes
${read_scsi_info}= OperatingSystem.Get File /sys/class/scsi_device/0:0:${scsi_id}:0/device/vendor
${read_scsi_info}= Remove String Using Regexp ${read_scsi_info} ${\n}
Log Vendor ID read from sysfs was --${read_scsi_info}--
Should Be Equal ${read_scsi_info} ${scsi_vendor} Incorrect SCSI vendor reported for ID ${scsi_id}
SCSI ID ${scsi_id} reports revision ${scsi_rev}
[Documentation] Reads the SCSI vendor from sysfs and checks that it matches expected value
${read_scsi_rev}= Get File /sys/class/scsi_device/0:0:${scsi_id}:0/device/rev
Log SCSI revision read from sysfs was ${read_scsi_rev}
Should Be Equal ${read_scsi_rev} ${scsi_rev} Incorrect SCSI version reported for ID ${scsi_id}
[Documentation] Reads the SCSI vendor from sysfs and checks that it matches expected value
${read_scsi_info}= OperatingSystem.Get File /sys/class/scsi_device/0:0:${scsi_id}:0/device/rev
${read_scsi_info}= Remove String Using Regexp ${read_scsi_info} ${\n}
Log SCSI revision read from sysfs was ${read_scsi_info}
Should Be Equal ${read_scsi_info} ${scsi_rev} Incorrect SCSI version reported for ID ${scsi_id}
SCSI ID ${scsi_id} reports model ${scsi_model}
[Documentation] Reads the SCSI vendor from sysfs and checks that it matches expected value
${read_scsi_model}= Get File /sys/class/scsi_device/0:0:${scsi_id}:0/device/rev
Log SCSI model read from sysfs was ${read_scsi_model}
Should Be Equal ${read_scsi_model} ${scsi_model} Incorrect SCSI model reported for ID ${scsi_id}
[Documentation] Reads the SCSI vendor from sysfs and checks that it matches expected value
${read_scsi_info}= OperatingSystem.Get File /sys/class/scsi_device/0:0:${scsi_id}:0/device/model
${read_scsi_info}= Remove String Using Regexp ${read_scsi_info} ${\n}
Log SCSI model read from sysfs was --${read_scsi_info}--
Should Be Equal ${read_scsi_info} ${scsi_model} Incorrect SCSI model reported for ID ${scsi_id}
SCSI ID ${scsi_id} reports type ${scsi_type}
[Documentation] Reads the SCSI type from sysfs and checks that it matches expected value
${read_scsi_type}= Get File /sys/class/scsi_device/0:0:${scsi_id}:0/device/rev
Log SCSI model read from sysfs was ${read_scsi_type}
Should Be Equal ${read_scsi_type} ${scsi_type} Incorrect SCSI model reported for ID ${scsi_id}
[Documentation] Reads the SCSI type from sysfs and checks that it matches expected value
${read_scsi_info}= OperatingSystem.Get File /sys/class/scsi_device/0:0:${scsi_id}:0/device/type
${read_scsi_info}= Remove String Using Regexp ${read_scsi_info} ${\n}
Log SCSI model read from sysfs was ${read_scsi_info}
Should Be Equal ${read_scsi_info} ${scsi_type} Incorrect SCSI type reported for ID ${scsi_id}

View File

@ -0,0 +1,87 @@
*** Settings ***
Documentation Test that the RaSCSI reports SCSI information correctly.
Library OperatingSystem
Resource Resources/rascsi_utils.resource
Resource Resources/linux_services.resource
Suite Setup Run Keywords Open Connection to Rascsi and Log In
... AND The Rascsi Service is Started
... AND The RaSCSI Service Should be Running
... AND Detach all SCSI Devices
Suite Teardown Close All Connections
*** Test Cases ***
Apple Hard Drive reports the correct device information
[Documentation] Create an empty Apple hard drive and verify that the SCSI
... information is reported correctly to the Linux host
[Setup] Run Keyword and Ignore Error Delete drive image apple_drive.hda
[Teardown] Run Keywords Detach SCSI ID 0 Delete drive image apple_drive.hda
Given Create Blank Rascsi Drive Image of Size 10 megabytes named apple_drive.hda
When Drive image apple_drive.hda is attached as SCSI ID 0
Then Rasctl reports SCSI ID 0 of type HD
And SCSI ID 0 reports vendor ${SPACE}SEAGATE
And SCSI ID 0 reports revision 0147
And SCSI ID 0 reports model ${SPACE*10}ST225N
And SCSI ID 0 reports type ${Scsi_device_type_hard_drive}
XM6 Hard Drive reports the correct device information
[Documentation] Create an empty XM6 hard drive and verify that the SCSI
... information is reported correctly to the Linux host
[Setup] Run Keyword and Ignore Error Delete drive image xm6_scsi_drive.hds
[Teardown] Run Keywords Detach SCSI ID 1 Delete drive image xm6_scsi_drive.hds
Given Create Blank Rascsi Drive Image of Size 10 megabytes named xm6_scsi_drive.hds
When Drive image xm6_scsi_drive.hds is attached as SCSI ID 1
Then Rasctl reports SCSI ID 1 of type HD
And SCSI ID 1 reports vendor ${SPACE}SEAGATE
And SCSI ID 1 reports revision 0147
And SCSI ID 1 reports model ${SPACE*10}ST225N
And SCSI ID 1 reports type ${Scsi_device_type_hard_drive}
NEC Hard Drive reports the correct device information
[Documentation] Create an empty NEC hard drive and verify that the SCSI
... information is reported correctly to the Linux host
[Setup] Run Keyword and Ignore Error Delete drive image nec_hard_drive.hdn
[Teardown] Run Keywords Detach SCSI ID 2 Delete drive image nec_hard_drive.hdn
Given Create Blank Rascsi Drive Image of Size 10 megabytes named nec_hard_drive.hdn
When Drive image nec_hard_drive.hdn is attached as SCSI ID 2
Then Rasctl reports SCSI ID 2 of type HD
And SCSI ID 2 reports vendor NECCSI${SPACE*2}
And SCSI ID 2 reports revision 0147
And SCSI ID 2 reports model PRODRIVE LPS10S${SPACE}
And SCSI ID 2 reports type ${Scsi_device_type_hard_drive}
Anex86 Hard Drive reports the correct device information
[Documentation] Create an empty Anex86 hard drive and verify that the SCSI
... information is reported correctly to the Linux host
[Setup] Run Keyword and Ignore Error Delete drive image anex86_hard_drive.hdi
[Teardown] Run Keywords Detach SCSI ID 3 Delete drive image anex86_hard_drive.hdi
Given Create Blank Rascsi Drive Image of Size 10 megabytes named anex86_hard_drive.hdi
When Drive image anex86_hard_drive.hdi is attached as SCSI ID 3
Then Rasctl reports SCSI ID 3 of type HD
And SCSI ID 3 reports vendor RaSCSI${SPACE*2}
And SCSI ID 3 reports revision 0147
And SCSI ID 3 reports model CD-ROM CDU-55S${SPACE*2}
And SCSI ID 3 reports type ${Scsi_device_type_hard_drive}
CD-ROM drive reports the correct device information
[Documentation] Create an CD-ROM drive with no media and verify that the SCSI
... information is reported correctly to the Linux host
[Teardown] Detach SCSI ID 4
When CD-ROM Drive is attached as SCSI ID 4
Then Rasctl reports SCSI ID 4 of type CD
And SCSI ID 4 reports vendor RaSCSI${SPACE*2}
And SCSI ID 4 reports revision 0147
And SCSI ID 4 reports model CD-ROM CDU-55S${SPACE*2}
And SCSI ID 4 reports type ${Scsi_device_type_cd_rom}
Magneto Optical drive reports the correct device information
[Documentation] Create an Magneto Optical drive with no media and verify
... that the SCSI information is reported correctly to the
... Linux host
[Teardown] Detach SCSI ID 5
When Magneto Optical drive is attached as SCSI ID 5
Then Rasctl reports SCSI ID 5 of type MO
And SCSI ID 5 reports vendor RaSCSI${SPACE*2}
And SCSI ID 5 reports revision 0147
And SCSI ID 5 reports model M2513A${SPACE*8}
And SCSI ID 5 reports type ${Scsi_device_type_optical_memory}

View File

@ -4,8 +4,8 @@ Library OperatingSystem
Resource Resources/rascsi_utils.resource
Resource Resources/linux_services.resource
Test Setup Open Connection to Rascsi and Log In
Test Teardown Close All Connections
Suite Setup Open Connection to Rascsi and Log In
Suite Teardown Close All Connections
*** Test Cases ***
RaSCSI Service Can be Started as a Service
@ -19,15 +19,7 @@ RaSCSI Service Can be Stopped as a Service
Then the RaSCSI Service should be Stopped
RaSCSI Service Can be Restarted as a Service
[Documentation] Start the Rascsi service and make sure it stays running
[Documentation] Restart the Rascsi service and make sure it stays running
Given The RaSCSI Service is Started
When The Rascsi Service is Restarted
Then the Rascsi Service should be Running
##*** Keywords ***
##Database Should Contain
# [Arguments] ${username} ${password} ${status}
# ${database} = Get File ${DATABASE FILE}
# Should Contain ${database} ${username}\t${password}\t${status}\n