From f357c0296a96e2c2bf1fe6d645ed185e1e9dae73 Mon Sep 17 00:00:00 2001 From: PhrAx <68938882+phrax0@users.noreply.github.com> Date: Sun, 6 Sep 2020 23:59:13 -0700 Subject: [PATCH 1/3] Update README.md Fixing up poorly written sentence. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f61ff20..3d508021 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,6 @@ # What is RaSCSI? -RaSCSI is a virtual SCSI device emulator that runs on a Raspberry Pi. It can emulate several SCSI devices at one time. There is a control interface to attach / detach drives during runtime, as well as insert and eject removable media. This project is aimed at users of vintage Macintosh computers from the 1980's and 1990's. +RaSCSI is a virtual SCSI device emulator that runs on a Raspberry Pi. It runs in userspace, and can emulate several SCSI devices at one time. There is a control interface to attach / detach drives during runtime, as well as insert and eject removable media. This project is aimed at users of vintage Macintosh computers from the 1980's and 1990's. Please check out the full story with much more detail on the [wiki](https://github.com/akuker/RASCSI/wiki)! From 7c5b645c4892333267f4fc34c37a587af0aa766a Mon Sep 17 00:00:00 2001 From: akuker <34318535+akuker@users.noreply.github.com> Date: Thu, 10 Sep 2020 13:06:36 -0500 Subject: [PATCH 2/3] Created an initial suite of tests to make sure that the RaSCSI is working properly (#33) * First cut of very simple robot tests * Remove log files and change test to use rascsi host name instead of hard-coded IP * Added more keywords * Added tests to check the reported SCSI vendor, revision, model and type * Moved the Linux (host) utilities to a different file * Added cdrom tests * Added cdrom tests * Finished up cd-rom tests. All tests pass, except for Anex86 drive Co-authored-by: akuker --- test/robot/.gitignore | 4 + .../robot/Resources/linux_scsi_utils.resource | 204 ++++++++++++++++++ test/robot/Resources/linux_services.resource | 30 +++ test/robot/Resources/rascsi_utils.resource | 124 +++++++++++ test/robot/rascsi_cd-rom_functionality.robot | 65 ++++++ test/robot/rascsi_device_information.robot | 94 ++++++++ test/robot/rascsi_service.robot | 25 +++ 7 files changed, 546 insertions(+) create mode 100644 test/robot/.gitignore create mode 100644 test/robot/Resources/linux_scsi_utils.resource create mode 100644 test/robot/Resources/linux_services.resource create mode 100644 test/robot/Resources/rascsi_utils.resource create mode 100644 test/robot/rascsi_cd-rom_functionality.robot create mode 100644 test/robot/rascsi_device_information.robot create mode 100644 test/robot/rascsi_service.robot diff --git a/test/robot/.gitignore b/test/robot/.gitignore new file mode 100644 index 00000000..03f3cf33 --- /dev/null +++ b/test/robot/.gitignore @@ -0,0 +1,4 @@ +log.html +output.xml +report.html + diff --git a/test/robot/Resources/linux_scsi_utils.resource b/test/robot/Resources/linux_scsi_utils.resource new file mode 100644 index 00000000..f9f91300 --- /dev/null +++ b/test/robot/Resources/linux_scsi_utils.resource @@ -0,0 +1,204 @@ + +*** Settings *** +Library String +Library Collections + +*** Variables *** +${drive_mount_path} /mnt/temp_drive/ + +# Taken from https://en.wikipedia.org/wiki/SCSI_Peripheral_Device_Type +${Scsi_device_type_hard_drive} 0 +${Scsi_device_type_magnetic_tape} 1 +${Scsi_device_type_printer} 2 +${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 *** + +Rescan SCSI Bus + [Documentation] Commands Linux to re-scan the SCSI bus on the local host + ${result}= Run sudo bash -c "echo \\"- - -\\" > /sys/class/scsi_host/host0/scan" + ${lsscsi}= Run lsscsi + log ${lsscsi} + +SCSI ID ${scsi_id:\d+} is detected by Linux + [Documentation] Checks to see if a specific SCSI ID is found by lsscsi + ${result}= Run lsscsi + Log ${result} + Should Contain ${result} [0:0:${scsi_id}:0] + +Delete all SCSI devices from Linux + [Documentation] Remove all SCSI IDs from the Linux SCSI driver + FOR ${scsi_id} IN RANGE 0 7 + Delete SCSI ID ${scsi_id} from Linux + END + +Delete SCSI ID ${scsi_id:\d+} from Linux + [Documentation] Remove a SCSI ID from Linux. Basically, will un-do the Scan action + Run sudo bash -c "echo 1 > /sys/class/scsi_device/0:0:${scsi_id}:0/device/delete" 2>&1 > /dev/null + +SCSI ID ${scsi_id} reports vendor ${scsi_vendor} + [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_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_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_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} + +Checksum of Data File ${file_name} from mounted drive + [Documentation] Calculate the checksum of the specified file from the mounted drive + ${sha_output}= Run sha512sum ${drive_mount_path}${file_name} + Log Checksum of the file was ${sha_output} + @{sha_output_list}= Split String ${sha_output} ${SPACE} + ${sha_signature}= Get From List ${sha_output_list} 0 + [Return] ${sha_signature} + +Get device id for SCSI ID ${scsi_id:/d+} + [Documentation] Lookup the device name (ex /dev/sr0) for the specified SCSI ID + ${lsscsi_output}= Run lsscsi --brief |grep \\\\[0\\\\:0\\\\:${scsi_id}\\\\:0\\\\] | cut -f 5 --delimiter=" " + Should Match Regexp ${lsscsi_output} \/dev\/[\\w\\d]+ Unable to find device ID for SCSI ID ${scsi_id} + [Return] ${lsscsi_output} + # log ${lsscsi_output} + # @{scsi_entries}= Split To Lines ${lsscsi_output} + # FOR ${cur_line} IN @{scsi_entries} + # Log ${cur_line} + # @{scsi_line}= SplitString ${cur_line} + # ${linux_id}= Set Variable ${scsi_line}[0] + # ${device_id}= Set Variable ${scsi_line}[1] + # Return From Keyword If "${linux_id}"=="[0:0:${scsi_id}:0]" ${device_id} + # END + # [Return] /dev/notfound + +Get size of device id ${device_id} in bytes + [Documentation] Decypher the output of lsblk to determine the size of the + ... specified device ID + ${bare_device_id}= Remove String Using Regexp ${device_id} \/dev\/ + ${lsblk_output}= Run lsblk --raw --bytes | grep ${bare_device_id} | cut -f 4 --delimiter=" " + [Return] ${lsblk_output} + +Get size of SCSI ID ${scsi_id} device in bytes + [Documentation] Given a SCSI ID, determine how big that drive is (in bytes) + ${device_id}= Get device id for SCSI ID ${scsi_id} + ${device_size}= Get size of device id ${device_id} in bytes + [Return] ${device_size} + +Get checksum of SCSI ID ${scsi_id} device + [Documentation] Calculate the checksum of the disk image on the RaSCSI host + ${device_id}= Get device id for SCSI ID ${scsi_id} + ${checksum}= Run Keyword Get checksum of file ${device_id} + [Return] ${checksum} + +Get checksum of file ${full_file_path} + ${checksum}= Run md5sum ${full_file_path} | cut -f 1 --delimiter=" " + [Return] ${checksum} + +Get filesystem type of SCSI ID ${scsi_id} + [Documentation] Get the type of file system for the specified scsi ID. It needs to be + ... mounted in order for this command to work + ${device_id}= Get device id for SCSI ID ${scsi_id} + ${raw}= Run mount | grep ${device_id} + log ${raw} + ${filesystem_type}= Run mount |grep ${device_id} |cut --delimiter=" " -f 5 + [Return] ${filesystem_type} + +The size of SCSI ID ${scsi_id} is equal to the size of ${image_name} + [Documentation] Get the size of the SCSI device specified and the size of the drive + ... image and make sure they're equal + ${device_size}= Get size of SCSI ID ${scsi_id} device in bytes + ${image_size}= Get Size of RaSCSI Image ${image_name} in bytes + Should be Equal ${device_size} ${image_size} The device size did not match the image size + +The checksum of SCSI ID ${scsi_id} is equal to the checksum of ${image_name} + [Documentation] Empty Keyword + ${device_checksum}= Get checksum of SCSI ID ${scsi_id} device + ${image_checksum}= Get checksum of RaSCSI Image ${image_name} + Should be Equal ${device_checksum} ${image_checksum} The device checksum did not match the image file + +Mount SCSI ID ${scsi_id} as ${folder_name} + [Documentation] Mount the specified SCSI ID at the specified path in /mnt + Run sudo mkdir -p /mnt/${folder_name} + ${device}= Get device id for SCSI ID ${scsi_id} + Run sudo mount ${device} /mnt/${folder_name} + ${df}= Run df -h + Log ${df} + +SCSI ID ${scsi_id} has been mounted at ${folder_name} + [Documentation] Check that the 'df' utility reports that the specified SCSI ID is + ... mounted at the path specified + ${device}= Get device id for SCSI ID ${scsi_id} + ${df_output}= Run mount | grep ${device} | cut --delimiter=" " -f 3 + log ${df_output} + +Unmount SCSI ID ${scsi_id} + [Documentation] Un-mount the drive specified. Currently, this doesn't use the drive ID. However, + ... it needs to be updated in the future to un-moune the correct device, instead of + ... of being hard-coded to a specific path. + ${device}= Get device id for SCSI ID ${scsi_id} + Run sudo umount ${device} + +The file ${filename} in the ${directory} directory matches the original in ISO ${drive_image} + [Documentation] Check that the file ready by the host through the RaSCSI interface and make sure + ... that the checksum matches the original file extracted from the ISO + ${host_file_checksum}= Get checksum of file /mnt/${directory}/${filename} + ${rascsi_file_checksum}= Get checksum of ${filename} from ISO ${drive_image} on the RaSCSI Host + Should be Equal ${host_file_checksum} ${rascsi_file_checksum} ${filename} did not match between the host and the RaSCSI + + +The filesystem type of SCSI ID ${scsi_id} is ${fs_type} + [Documentation] Fetches the filesystem type of the specified SCSI ID and checks that it matches + ${actual_fs_type}= Get filesystem type of SCSI ID ${scsi_id} + Should be Equal ${fs_type} ${actual_fs_type} Incorrect file system type detected + +The measured read speed for ${data_size} megabytes of data from SCSI ID ${scsi_id} is greater than ${expected_speed} KB/s + [Documentation] Read the specified amount of data from the SCSI drive and make sure that it is + ... greater than the specified threshold + [Teardown] Remove temporary file ${temp_filename} + ${device_id}= Get device id for SCSI ID ${scsi_id} + ${temp_filename}= Generate Random String 10 [LETTERS] + ${dd_time}= Run sudo dd if=${device_id} of=/tmp/${temp_filename} bs=1M count=${data_size} 2>&1 | awk '/copied/ {print $8}' + ${copy_time}= Convert to Number ${dd_time} + ${speed}= Evaluate (${data_size}*1024)/${copy_time} + Log Measured copy speed was ${speed} KB/s + Should be true ${speed}>=${expected_speed} Measured speed was not greater than minimum + # Run sudo rm /tmp/${temp_filename} + +Create an image named ${iso_name} from SCSI ID ${scsi_id} + [Documentation] Will create a disk image from the specified SCSI device + ${device_id}= Get device id for SCSI ID ${scsi_id} + ${dd_output}= Run sudo dd if=${device_id} of=/tmp/${iso_name} bs=1M 2>&1 + File Should Not be Empty /tmp/${iso_name} + +Local file ${local_file_name} matches RaSCSI file ${rascsi_file_name} + [Documentation] Calculates the checksum of the local file and the remote file + ... then ensures that they match + ${local_file_checksum}= Get checksum of file /tmp/${local_file_name} + ${remote_file_checksum}= Get checksum of RaSCSI Image ${rascsi_file_name} + Should be Equal ${local_file_checksum} ${remote_file_checksum} Files did not match + +Remove temporary file ${file_name} + [Documentation] Deletes the specified file from the temp directory + Run sudo rm /tmp/${file_name} \ No newline at end of file diff --git a/test/robot/Resources/linux_services.resource b/test/robot/Resources/linux_services.resource new file mode 100644 index 00000000..5389cd8b --- /dev/null +++ b/test/robot/Resources/linux_services.resource @@ -0,0 +1,30 @@ + +*** Settings *** +Library SSHLibrary +Library String + +*** Variables *** +#${Rascsi_Password} raspberry + +*** Keywords *** +The ${service_name} Service Should be Running + ${lc_service_name}= Convert To Lower Case ${service_name} + ${output}= Execute Command systemctl status ${lc_service_name} + Should Contain ${output} Active: active (running) ignore_case=True + +The ${service_name} Service Should be Stopped + ${lc_service_name}= Convert To Lower Case ${service_name} + ${output}= Execute Command systemctl status ${lc_service_name} + Should Contain ${output} Active: failed ignore_case=True + +The ${service_name} Service is Stopped + ${lc_service_name}= Convert To Lower Case ${service_name} + Execute Command systemctl stop ${lc_service_name} sudo=True sudo_password=${Rascsi_Password} + +The ${service_name} Service is Restarted + ${lc_service_name}= Convert To Lower Case ${service_name} + Execute Command systemctl restart ${lc_service_name} sudo=True sudo_password=${Rascsi_Password} + +The ${service_name} Service is Started + ${lc_service_name}= Convert To Lower Case ${service_name} + Execute Command systemctl start ${lc_service_name} sudo=True sudo_password=${Rascsi_Password} diff --git a/test/robot/Resources/rascsi_utils.resource b/test/robot/Resources/rascsi_utils.resource new file mode 100644 index 00000000..9e12261d --- /dev/null +++ b/test/robot/Resources/rascsi_utils.resource @@ -0,0 +1,124 @@ + +*** Settings *** +Library SSHLibrary +Library Process +Library String +Resource linux_services.resource + +*** Variables *** +${Rascsi_Host} rascsi.local +${Rascsi_Username} pi +${Rascsi_Password} raspberry + + +*** 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} 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} bs=1M count=${drive_size} + +Delete drive image ${file_name} + [Documentation] Delete a disk drive image that was created on the raspberry pi + Remove File /home/pi/images/${file_name} + +Delete all RaSCSI drive images + [Documentation] Delete all of the temporary drive images that were created on the RaSCSI host + Remove File /home/pi/images/tmp_* + +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 RaSCSI 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 0 7 + Detach RaSCSI SCSI ID ${scsi_id} + END + +Detach RaSCSI SCSI ID ${scsi_id:\d+} + [Documentation] Detaches the specified SCSI ID from Rascsi + Execute Command rasctl -c detach -i ${scsi_id} + +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}| + +# Create a ${iso_size} megabyte ISO named ${image_name} with random data +# [Documentation] Creates a file on the RaSCSI with random data (from /dev/urandom), +# ... then creates an ISO image with that data +# Execute Command mkdir /tmp/new_iso +# Execute Command dd if=/dev/urandom of=/tmp/new_iso/data.dat bs=1M count=${iso_size} +# Execute Command genisoimage -o /home/pi/images/${image_name} /tmp/new_iso/ + +Insert Removable Media ${image} into SCSI ID ${scsi_id} + Execute Command rasctl -c insert -i ${scsi_id} -f /home/pi/images/${image} + ${result}= Execute Command rasctl -l + Log ${result} + +Removable media ${image} is inserted into SCSI ID ${scsi_id:/d+} + [Documentation] Inserts the sepecified image name into the removable media drive + Execute Command rasctl -c insert -i ${scsi_id} -f /home/pi/images/${image} + +# Insert removable media ${image_name} into SCSI ID ${scsi_id:/d+} +# [Documentation] Inserts the sepecified image name into the removable media drive +# Execute Command rasctl -c insert -i ${scsi_id} -f /home/pi/images/${image_name} + +Eject removable media from SCSI ID ${scsi_id:/d+} + [Documentation] Inserts the sepecified image name into the removable media drive + Execute Command rasctl -c eject -i ${scsi_id} + +Checksum of Random Data File from RaSCSI + [Documentation] Calcualte the SHA signature of the random data that was generated + ... on the RaSCSI host + ${sha_output}= Execute Command sha512sum /tmp/new_iso/data.dat | cut -f 1 + Log Checksum of the file was ${sha_output} + [Return] ${sha_output} + +Get checksum of RaSCSI Image ${image_name} + [Documentation] Calculate the checksum of the disk image on the RaSCSI host + ${checksum}= Execute Command md5sum /home/pi/images/${image_name} | cut -f 1 --delimiter=" " + [Return] ${checksum} + +Get Size of RaSCSI Image ${image_name} in bytes + [Documentation] Return the size of the specified disk image in bytes + ${size_output}= Execute Command du -b /home/pi/images/${image_name} | cut -f 1 + [Return] ${size_output} + + +Get checksum of ${filename} from ISO ${image_name} on the RaSCSI Host + [Documentation] Extracts the specified file from the ISO, calculates the checksum + ... then returns that value + ${temp_dirname}= Generate Random String 10 [LETTERS] + Execute Command mkdir /tmp/${temp_dirname} sudo=True sudo_password=${Rascsi_Password} + Execute Command mount /home/pi/images/${image_name} /tmp/${temp_dirname} sudo=True sudo_password=${Rascsi_Password} + ${checksum}= Execute Command md5sum /tmp/${temp_dirname}/${filename} | cut -f 1 --delimiter=" " + Execute Command umount /tmp/${temp_dirname} sudo=True sudo_password=${Rascsi_Password} + Execute Command rm -rf /tmp/${temp_dirname} sudo=True sudo_password=${Rascsi_Password} + [Return] ${checksum} + diff --git a/test/robot/rascsi_cd-rom_functionality.robot b/test/robot/rascsi_cd-rom_functionality.robot new file mode 100644 index 00000000..05417fe3 --- /dev/null +++ b/test/robot/rascsi_cd-rom_functionality.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation Test the RaSCSI CD-ROM emulation functionality. +Library OperatingSystem +Resource Resources/rascsi_utils.resource +Resource Resources/linux_services.resource +Resource Resources/linux_scsi_utils.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 RaSCSI SCSI Devices +Suite Teardown Run Keywords Detach all RaSCSI SCSI Devices +... AND Delete all SCSI devices from Linux +... AND Close All Connections + +Test Teardown Run Keywords Detach all RaSCSI SCSI Devices +... AND Delete all SCSI devices from Linux +... AND Delete all RaSCSI drive images + +*** Test Cases *** +MacOS formated ISO is mounted and correct size is reported + [Documentation] Mount a MacOS formatted ISO and check that its size is + ... detected correctly. Note that Linux is not able to + ... mount this image. Note: Marathon was chosen because + ... its a reasonably small image. Large images will make + ... this test take a LONG time. + Given CD-ROM Drive is attached as SCSI ID 6 + When Insert Removable Media marathon.iso into SCSI ID 6 + Then the size of SCSI ID 6 is equal to the size of marathon.iso + And the checksum of SCSI ID 6 is equal to the checksum of marathon.iso + +ISO-9660 formated ISO is mounted correct size is reported + [Documentation] Mount a pre-made IDS-9660 formatted ISO and check + ... that it is read correctly + [Teardown] Unmount SCSI ID 5 + Given CD-ROM Drive is attached as SCSI ID 5 + When Insert Removable Media ubuntu-12.04.5-server-amd64.iso into SCSI ID 5 + And Mount SCSI ID 5 as ubuntu + Then SCSI ID 5 has been mounted at ubuntu + And the size of SCSI ID 5 is equal to the size of ubuntu-12.04.5-server-amd64.iso + And the filesystem type of SCSI ID 5 is iso9660 + And the file pics/debian.jpg in the ubuntu directory matches the original in ISO ubuntu-12.04.5-server-amd64.iso + And the file install/vmlinuz in the ubuntu directory matches the original in ISO ubuntu-12.04.5-server-amd64.iso + +CD-ROM Read Speed is as fast as expected + [Documentation] Check that the read speed from the emulated CD-ROM is within + ... the expected range. This should detect if a change cause the + ... drive to slow down significantly + Given CD-ROM Drive is attached as SCSI ID 2 + When insert Removable Media ubuntu-12.04.5-server-amd64.iso into SCSI ID 2 + Then the measured read speed for 1 megabytes of data from SCSI ID 2 is greater than 750 KB/s + Then the measured read speed for 10 megabytes of data from SCSI ID 2 is greater than 950 KB/s + And the measured read speed for 100 megabytes of data from SCSI ID 2 is greater than 950 KB/s + + +Create an ISO from a RaSCSI CD-ROM device and verify it matches + [Documentation] On the RaSCSI, we'll mount an ISO, then on the host system, we + ... will generate a new ISO from the emulated CD-ROM and make sure + ... that it matches the original + [Teardown] Remove temporary file dup_simtower.iso + Given CD-ROM Drive is attached as SCSI ID 0 + When Insert removable media simtower.iso into SCSI ID 0 + And create an image named dup_simtower.iso from SCSI ID 0 + Then local file dup_simtower.iso matches RaSCSI file simtower.iso + diff --git a/test/robot/rascsi_device_information.robot b/test/robot/rascsi_device_information.robot new file mode 100644 index 00000000..c5673842 --- /dev/null +++ b/test/robot/rascsi_device_information.robot @@ -0,0 +1,94 @@ +*** Settings *** +Documentation Test that the RaSCSI reports SCSI information correctly. +Library OperatingSystem +Resource Resources/rascsi_utils.resource +Resource Resources/linux_services.resource +Resource Resources/linux_scsi_utils.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 RaSCSI SCSI Devices +Suite Teardown Run Keywords Detach all RaSCSI SCSI Devices +... AND Delete all SCSI devices from Linux +... AND Close All Connections + +Test Teardown Run Keywords Detach all RaSCSI SCSI Devices +... AND Delete all SCSI devices from Linux +... AND Delete all RaSCSI drive images + +*** 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 tmp_apple_drive.hda + Given Create Blank Rascsi Drive Image of Size 10 megabytes named tmp_apple_drive.hda + When Drive image tmp_apple_drive.hda is attached as SCSI ID 0 + Then Rasctl reports SCSI ID 0 of type HD + And SCSI ID 0 is detected by Linux + 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 tmp_xm6_scsi_drive.hds + Given Create Blank Rascsi Drive Image of Size 10 megabytes named tmp_xm6_scsi_drive.hds + When Drive image tmp_xm6_scsi_drive.hds is attached as SCSI ID 1 + Then Rasctl reports SCSI ID 1 of type HD + And SCSI ID 1 is detected by Linux + And SCSI ID 1 reports vendor RaSCSI${SPACE*2} + And SCSI ID 1 reports revision 0147 + And SCSI ID 1 reports model PRODRIVE LPS10S${SPACE} + 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 tmp_nec_hard_drive.hdn + Given Create Blank Rascsi Drive Image of Size 10 megabytes named tmp_nec_hard_drive.hdn + When Drive image tmp_nec_hard_drive.hdn is attached as SCSI ID 2 + Then Rasctl reports SCSI ID 2 of type HD + And SCSI ID 2 is detected by Linux + 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 tmp_anex86_hard_drive.hdi + Given Create Blank Rascsi Drive Image of Size 10 megabytes named tmp_anex86_hard_drive.hdi + When Drive image tmp_anex86_hard_drive.hdi is attached as SCSI ID 3 + Then Rasctl reports SCSI ID 3 of type HD + And SCSI ID 3 is detected by Linux + 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 + When CD-ROM Drive is attached as SCSI ID 4 + Then Rasctl reports SCSI ID 4 of type CD + And SCSI ID 4 is detected by Linux + 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 + When Magneto Optical drive is attached as SCSI ID 5 + Then Rasctl reports SCSI ID 5 of type MO + And SCSI ID 5 is detected by Linux + And SCSI ID 5 reports vendor RaSCSI${SPACE*2} + And SCSI ID 5 reports revision 0147 + And SCSI ID 5 reports model M2513A${SPACE*10} + And SCSI ID 5 reports type ${Scsi_device_type_optical_memory} diff --git a/test/robot/rascsi_service.robot b/test/robot/rascsi_service.robot new file mode 100644 index 00000000..cc13f749 --- /dev/null +++ b/test/robot/rascsi_service.robot @@ -0,0 +1,25 @@ +*** Settings *** +Documentation Test that the RaSCSI service can be started and stopped. +Library OperatingSystem +Resource Resources/rascsi_utils.resource +Resource Resources/linux_services.resource + +Suite Setup Open Connection to Rascsi and Log In +Suite Teardown Close All Connections + +*** Test Cases *** +RaSCSI Service Can be Started as a Service + [Documentation] Start the Rascsi service and make sure it stays running + When The Rascsi Service is Started + Then The RaSCSI Service Should be Running + +RaSCSI Service Can be Stopped as a Service + [Documentation] Stop the Rascsi service and make sure it stays stopped + When the Rascsi Service is Stopped + Then the RaSCSI Service should be Stopped + +RaSCSI Service Can be Restarted as a Service + [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 From 05ae013fad66309df8f744280891b0a55efc8bc4 Mon Sep 17 00:00:00 2001 From: PhrAx <68938882+phrax0@users.noreply.github.com> Date: Sat, 12 Sep 2020 15:48:35 -0700 Subject: [PATCH 3/3] Update rascsi.cpp Changed "No device is installed." to "No images currently attached.". I think looking for currently attached images. The 'device' wording is confusing, even though it may be accurate. --- src/raspberrypi/rascsi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raspberrypi/rascsi.cpp b/src/raspberrypi/rascsi.cpp index 6e088dc8..e4e791b2 100644 --- a/src/raspberrypi/rascsi.cpp +++ b/src/raspberrypi/rascsi.cpp @@ -314,7 +314,7 @@ void ListDevice(FILE *fp) // If there is no controller, find will be null if (!find) { - FPRT(fp, "No device is installed.\n"); + FPRT(fp, "No images currently attached.\n"); return; }