Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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 <zhanghongyuan@uniontech.com> Thu, 15 Oct 2026 11:43:48 +0800

deepin-devicemanager (6.0.73) unstable; urgency=medium

* chore: Update version to 6.0.73
Expand Down
2 changes: 1 addition & 1 deletion deepin-devicemanager/src/GenerateDevice/CmdTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void CmdTool::addWidthToMap(QMap<QString, QString> &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"];
Expand Down
44 changes: 41 additions & 3 deletions deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
// 覆盖 CmdTool 的纯字符串解析方法 getMapInfoFrom*(Cmd/Input/Lshw/Hwinfo/Dmidecode/Smartctl)
// 及 getMulHwinfoInfo/addWidthToMap/getSMBIOSVersion。均为纯逻辑,构造输入字符串即覆盖。

#include "CmdTool.h"

Check warning on line 8 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "CmdTool.h" not found.
#include "ut_Head.h"

Check warning on line 9 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "ut_Head.h" not found.
#include "stub.h"

Check warning on line 10 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "stub.h" not found.

#include <QMap>

Check warning on line 12 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QMap> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QString>

Check warning on line 13 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QString> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QStringList>

Check warning on line 14 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QStringList> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QProcess>

Check warning on line 15 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QProcess> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QByteArray>

Check warning on line 16 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QByteArray> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <gtest/gtest.h>

Check warning on line 18 in deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool_parse.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <gtest/gtest.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

class UT_CmdToolParse : public UT_HEAD
{
Expand Down Expand Up @@ -123,12 +126,47 @@
EXPECT_NO_FATAL_FAILURE(tool->getMulHwinfoInfo("block1\nblock2\n"));
}

// addWidthToMap
TEST_F(UT_CmdToolParse, addWidthToMap)
// addWidthToMap: 非 NVIDIA 显卡提前返回(不进入正则解析)
TEST_F(UT_CmdToolParse, addWidthToMap_nonNvidia)
{
QMap<QString, QString> 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<QString, QString> 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
Expand Down
Loading