mirror of
https://github.com/akuker/RASCSI.git
synced 2026-10-25 12:02:59 +00:00
Move GPIO mappings into a single module and select a board profile at process startup instead of at compile time: Build every GPIO-facing utility for every supported profile. At the same time, we remove support for the historical AIBOM board type since it's the only one using positive logic, the other three variants share the same electrical behavior. Run piscsi, scsimon, scsiloop, scsidump, or sasidump with -C=STANDARD, FULLSPEC, or GAMERNIUM. FULLSPEC remains the default. To select a profile for the systemd service, set PISCSI_CONNECTION_TYPE and restart the service.
61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include "hal/connection_profile.h"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
using namespace std;
|
|
|
|
TEST(ConnectionProfile, SelectsEachSupportedMapping)
|
|
{
|
|
string error;
|
|
|
|
ASSERT_TRUE(SetConnectionType("STANDARD", error));
|
|
EXPECT_EQ(connection_type::standard, GetConnectionProfile().type);
|
|
EXPECT_EQ(10, GetConnectionProfile().pins.data[0]);
|
|
EXPECT_EQ(-1, GetConnectionProfile().pins.dtd);
|
|
|
|
ASSERT_TRUE(SetConnectionType("gamernium", error));
|
|
EXPECT_EQ(connection_type::gamernium, GetConnectionProfile().type);
|
|
EXPECT_EQ(21, GetConnectionProfile().pins.data[0]);
|
|
EXPECT_EQ(5, GetConnectionProfile().pins.dtd);
|
|
|
|
ASSERT_TRUE(SetConnectionType("FULLSPEC", error));
|
|
EXPECT_EQ(connection_type::fullspec, GetConnectionProfile().type);
|
|
EXPECT_EQ(10, GetConnectionProfile().pins.data[0]);
|
|
EXPECT_EQ(8, GetConnectionProfile().pins.dtd);
|
|
}
|
|
|
|
TEST(ConnectionProfile, RejectsUnsupportedMapping)
|
|
{
|
|
string error;
|
|
|
|
EXPECT_FALSE(SetConnectionType("AIBOM", error));
|
|
EXPECT_EQ("Invalid connection type 'AIBOM'. Supported types are STANDARD, FULLSPEC, and GAMERNIUM", error);
|
|
}
|
|
|
|
TEST(ConnectionProfile, RemovesSelectionOptionFromArguments)
|
|
{
|
|
char program[] = "piscsi";
|
|
char option[] = "-C";
|
|
char connection[] = "GAMERNIUM";
|
|
char argument[] = "-r";
|
|
char value[] = "7";
|
|
vector<char*> args = {program, option, connection, argument, value};
|
|
string error;
|
|
|
|
ASSERT_TRUE(ConfigureConnectionType(args, error));
|
|
ASSERT_EQ(3U, args.size());
|
|
EXPECT_STREQ("piscsi", args[0]);
|
|
EXPECT_STREQ("-r", args[1]);
|
|
EXPECT_STREQ("7", args[2]);
|
|
EXPECT_EQ(connection_type::gamernium, GetConnectionProfile().type);
|
|
|
|
ASSERT_TRUE(SetConnectionType("FULLSPEC", error));
|
|
}
|