[partition] Fix up tests
This commit is contained in:
parent
7291656f19
commit
8639c9a79f
@ -19,6 +19,14 @@ QTEST_GUILESS_MAIN( ClearMountsJobTests )
|
|||||||
/* Not exactly public API */
|
/* Not exactly public API */
|
||||||
QStringList getPartitionsForDevice( const QString& deviceName );
|
QStringList getPartitionsForDevice( const QString& deviceName );
|
||||||
|
|
||||||
|
/* At one point, the partitions-list was read from /proc/partitions by
|
||||||
|
* running awk and grep, as below. Check that the current implementation
|
||||||
|
* matches that crufty one.
|
||||||
|
*
|
||||||
|
* Update 2021-11-02: the newer implementation prepends /dev/ to the
|
||||||
|
* names of the partitions, for simplicity elsewhere, so that needs
|
||||||
|
* to be added in to the awk(1) program, too.
|
||||||
|
*/
|
||||||
QStringList
|
QStringList
|
||||||
getPartitionsForDevice_other( const QString& deviceName )
|
getPartitionsForDevice_other( const QString& deviceName )
|
||||||
{
|
{
|
||||||
@ -26,7 +34,7 @@ getPartitionsForDevice_other( const QString& deviceName )
|
|||||||
process.setProgram( "sh" );
|
process.setProgram( "sh" );
|
||||||
process.setArguments(
|
process.setArguments(
|
||||||
{ "-c",
|
{ "-c",
|
||||||
QString( "echo $(awk '{print $4}' /proc/partitions | sed -e '/name/d' -e '/^$/d' -e '/[1-9]/!d' | grep %1)" )
|
QString( "echo $(awk '{print \"/dev/\"$4}' /proc/partitions | sed -e '/name/d' -e '/^$/d' -e '/[1-9]/!d' | grep %1)" )
|
||||||
.arg( deviceName ) } );
|
.arg( deviceName ) } );
|
||||||
process.start();
|
process.start();
|
||||||
process.waitForFinished();
|
process.waitForFinished();
|
||||||
|
Loading…
Reference in New Issue
Block a user