Skip to content

Commit

Permalink
Add test for ModeSelect page 1
Browse files Browse the repository at this point in the history
Follow up on PiSCSI#1402, PiSCSI#1405 which had a full test case missing.

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
  • Loading branch information
kkaempf committed Apr 1, 2024
1 parent 09ea598 commit b3c6f8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions cpp/test/mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ class MockSCSIHD : public SCSIHD //NOSONAR Ignore inheritance hierarchy depth in
FRIEND_TEST(ScsiHdTest, GetSectorSizes);
FRIEND_TEST(ScsiHdTest, ModeSelect);
FRIEND_TEST(ScsiHdTest, SetSectorSize);
FRIEND_TEST(ScsiHdTest, PageCode1);

FRIEND_TEST(PiscsiExecutorTest, SetSectorSize);

Expand Down
12 changes: 12 additions & 0 deletions cpp/test/scsihd_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,15 @@ TEST(ScsiHdTest, SetSectorSize)
EXPECT_NO_THROW(hd.ModeSelect(scsi_command::eCmdModeSelect6, cmd, buf, buf.size())) << "Set sector size is supported";
// FIXME: EXPECT_EQ(9, hd.GetSectorSizeShiftCount()) << "Set sector size to 512";
}

// Test for the ModeSelect6, page code 1 (issued by Alpha VMS)
TEST(ScsiHdTest, PageCode1)
{
MockSCSIHD hd(0, false);
vector<int> cmd = { 0x15, 0x10, 0x00, 0x00, 0x19, 0x00 };
vector<uint8_t> buf = { 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00
, 0x01, 0x0a, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

EXPECT_NO_THROW(hd.ModeSelect(scsi_command::eCmdModeSelect6, cmd, buf, buf.size())) << "Page code 1 is supported";
}

0 comments on commit b3c6f8c

Please sign in to comment.