diff --git a/debian/changelog b/debian/changelog index 8938b49c8..01f85c68b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,25 @@ +deepin-devicemanager (6.0.74) unstable; urgency=medium + + * chore: Update version to 6.0.74 + * fix(cpu): Fix CPU vendor info from dmidecode + * fix: correct SPDX copyright year separator to hyphen + * fix: replace busy-wait spin with waitForDone in ThreadPool + * fix: remove m_CoreId check in logicalIsExisted + * fix: use find() to avoid implicit map insert and fix SPDX copyright header + * fix: strip /sys prefix precisely in isPathExisted + * fix: use exact match for dpkg process name in isDpkgLocked + * test(unittest): add unit tests for deepin-devicemanager-server modules + * fix: distinguish ENOENT from lock in isFileLocked + * fix: add TTL cache invalidation for GPU info and update SPDX year + * fix: prevent QMap silent insert and update SPDX year + * test(unittest): enhance tests for ArmGenerator, X86Generator and DBusAnythingInterface + * test(unittest): add unit tests for ArmGenerator and X86Generator + * test(unittest): add unit tests for DetailButton, DetailSeperator and ScrollAreaWidget + * test(unittest): add unit tests for PageDriverInstallInfo and DBusAnythingInterface + * fix: correct target view in setCheckedCBDisnable + + -- zhanghongyuan Thu, 15 Oct 2026 11:43:48 +0800 + deepin-devicemanager (6.0.73) unstable; urgency=medium * chore: Update version to 6.0.73 diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index e655d201c..3f3d496fe 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -742,7 +742,7 @@ void CmdTool::addWidthToMap(QMap &mapInfo) sInfo = process.readAllStandardOutput(); QStringList lines = sInfo.split("\n"); foreach (const QString &line, lines) { - QRegularExpression reg("\\s\\sAttribute\\s'GPUMemoryInterface' \\(.*\\):\\s([0-9]{2}).*"); + QRegularExpression reg("\\s\\sAttribute\\s'GPUMemoryInterface' \\(.*\\):\\s([0-9]+).*"); if (reg.match(line).hasMatch()) { mapInfo.insert("Width", reg.match(line).captured(1) + " bits"); // qCDebug(appLog) << "Found width:" << mapInfo["Width"]; diff --git a/deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp b/deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp index 731e2a1f9..f65322f09 100644 --- a/deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp +++ b/deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp @@ -7,10 +7,13 @@ #include "CmdTool.h" #include "ut_Head.h" +#include "stub.h" #include #include #include +#include +#include #include @@ -123,12 +126,47 @@ TEST_F(UT_CmdToolParse, getMulHwinfoInfo) EXPECT_NO_FATAL_FAILURE(tool->getMulHwinfoInfo("block1\nblock2\n")); } -// addWidthToMap -TEST_F(UT_CmdToolParse, addWidthToMap) +// addWidthToMap: 非 NVIDIA 显卡提前返回(不进入正则解析) +TEST_F(UT_CmdToolParse, addWidthToMap_nonNvidia) { QMap m; - m["width"] = "64 bits"; + m["Vendor"] = "Intel Corporation"; EXPECT_NO_FATAL_FAILURE(tool->addWidthToMap(m)); + EXPECT_FALSE(m.contains("Width")); +} + +// QProcess 桩: 模拟 nvidia-settings 输出(256 bits,三位数位宽) +static void ut_addWidth_start(QProcess * /*self*/, const QString & /*p*/, + const QStringList & /*a*/, QIODevice::OpenMode /*m*/) +{ + return; +} +static bool ut_addWidth_wait(QProcess * /*self*/, int /*msecs*/) +{ + return true; +} +static QByteArray ut_addWidth_read(QProcess * /*self*/) +{ + return QByteArray( + " Attribute 'GPUMemoryInterface' (host:0[gpu:0]): 256.\n"); +} + +// addWidthToMap: NVIDIA 显卡,正则正确捕获三位数位宽 256 +TEST_F(UT_CmdToolParse, addWidthToMap_nvidia_256bits) +{ + QMap m; + m["Vendor"] = "NVIDIA Corporation"; + + Stub stub; + stub.set(((void (QProcess::*)(const QString &, const QStringList &, + QIODevice::OpenMode))ADDR(QProcess, start)), + ut_addWidth_start); + stub.set(((bool (QProcess::*)(int))ADDR(QProcess, waitForFinished)), + ut_addWidth_wait); + stub.set(ADDR(QProcess, readAllStandardOutput), ut_addWidth_read); + + tool->addWidthToMap(m); + EXPECT_EQ(m.value("Width"), QString("256 bits")); } // getSMBIOSVersion