Use /dev/disk/by-id/ to get device symlink in test_BlockSpecial
Found that older but still supported distributions Debian 8 and Ubuntu 14.04 LTS don't have directory /dev/disk/by-path/. This is used by the BlockSpecial unit test as a source of a symbolic link to a block special device. This causes the unit test to fail like this: $ cd tests $ ./test_BlockSpecial ... [ RUN ] BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches test_BlockSpecial.cc:137: Failure Failed get_link_name(): Failed to open directory '/dev/disk/by-path' test_BlockSpecial.cc:168: Failure Failed follow_link_name(): Failed to resolve symbolic link '' test_BlockSpecial.cc:255: Failure Expected: (lnk.m_name.c_str()) != (bs.m_name.c_str()), actual: "" vs "" [ FAILED ] BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches (0 ms) ... [ FAILED ] 1 test, listed below: [ FAILED ] BlockSpecialTest.NamedBlockSpecialObjectBySymlinkMatches 1 FAILED TEST Which in turn causes make check and make distcheck to fail. Use directory /dev/disk/by-id/ instead as it always exists.
This commit is contained in:
parent
fc215d0c2e
commit
7fe4148074
|
@ -23,7 +23,7 @@
|
||||||
* needed for the tests:
|
* needed for the tests:
|
||||||
*
|
*
|
||||||
* Name Access Note
|
* Name Access Note
|
||||||
* ------------------------- ------- -----
|
* ----------------------- ------- -----
|
||||||
* / Stat
|
* / Stat
|
||||||
* /proc/partitions Stat
|
* /proc/partitions Stat
|
||||||
* Read To find any two block
|
* Read To find any two block
|
||||||
|
@ -32,9 +32,9 @@
|
||||||
* /proc/partitions
|
* /proc/partitions
|
||||||
* /dev/BLOCK1 stat Second entry from
|
* /dev/BLOCK1 stat Second entry from
|
||||||
* /proc/partitions
|
* /proc/partitions
|
||||||
* /dev/disk/by-path/ Readdir To find any symlink to a
|
* /dev/disk/by-id/ Readdir To find any symlink to a
|
||||||
* block device
|
* block device
|
||||||
* /dev/disk/by-path/SYMLINK Stat First directory entry
|
* /dev/disk/by-id/SYMLINK Stat First directory entry
|
||||||
* /dev/RBLOCK Stat Device to which SYMLINK
|
* /dev/RBLOCK Stat Device to which SYMLINK
|
||||||
* refers
|
* refers
|
||||||
*
|
*
|
||||||
|
@ -128,13 +128,13 @@ static std::string get_block_name( unsigned want )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return symbolic link to a block device by reading the first entry in the directory
|
// Return symbolic link to a block device by reading the first entry in the directory
|
||||||
// /dev/disk/by-path/.
|
// /dev/disk/by-id/.
|
||||||
static std::string get_link_name()
|
static std::string get_link_name()
|
||||||
{
|
{
|
||||||
DIR * dir = opendir( "/dev/disk/by-path" );
|
DIR * dir = opendir( "/dev/disk/by-id" );
|
||||||
if ( dir == NULL )
|
if ( dir == NULL )
|
||||||
{
|
{
|
||||||
ADD_FAILURE() << __func__ << "(): Failed to open directory '/dev/disk/by-path'";
|
ADD_FAILURE() << __func__ << "(): Failed to open directory '/dev/disk/by-id'";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,9 +153,9 @@ static std::string get_link_name()
|
||||||
closedir( dir );
|
closedir( dir );
|
||||||
|
|
||||||
if ( found )
|
if ( found )
|
||||||
return std::string( "/dev/disk/by-path/" ) + dentry->d_name;
|
return std::string( "/dev/disk/by-id/" ) + dentry->d_name;
|
||||||
|
|
||||||
ADD_FAILURE() << __func__ << "(): No entries found in directory '/dev/disk/by-path'";
|
ADD_FAILURE() << __func__ << "(): No entries found in directory '/dev/disk/by-id'";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue