Skip to content

Commit

Permalink
Merge pull request #57 from rweickelt/fix-windows-test
Browse files Browse the repository at this point in the history
Fix windows tests
  • Loading branch information
rweickelt authored Nov 1, 2018
2 parents 18cbbdc + 0b72503 commit c47e72d
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 101 deletions.
10 changes: 7 additions & 3 deletions dist/distribute.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Product {
name: "distribute"
type: "installable"
condition : qbs.architecture.contains("x86")
builtByDefault: qbs.buildVariant.contains("release")

Depends { name: "cpp" }
Depends { name: "Qt.core" }
Expand Down Expand Up @@ -39,6 +38,7 @@ Product {
suffix += "d";
return suffix + cpp.dynamicLibrarySuffix;
}

files: {
function addQtVersions(libs) {
var result = [];
Expand All @@ -61,6 +61,10 @@ Product {
"Qt5Qml" + postfix,
"Qt5SerialPort" + postfix
);

if (qbs.buildVariant === "debug") {
list.push("Qt5Test" + postfix);
}
}

if (qbs.targetOS.contains("linux")) {
Expand All @@ -78,7 +82,7 @@ Product {
}

Group {
name: "Runtime DLLs - MinGW on Windows"
name: "Runtime DLLs - MinGW on Windows host"
condition: qbs.targetOS.contains("windows")
&& qbs.hostOS.contains("windows")
&& qbs.toolchain.contains("mingw")
Expand All @@ -95,7 +99,7 @@ Product {
}

Group {
name: "Runtime DLLs - MinGW on Linux"
name: "Runtime DLLs - MinGW on Linux host"
condition: qbs.targetOS.contains("windows")
&& qbs.hostOS.contains("linux")

Expand Down
13 changes: 9 additions & 4 deletions share/qst/imports/ti/UniflashProbe.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ Component {
property string device
property string file

readonly property string host: (Qst.hostOS === "linux") ? "linux" : "win"

signal finished

function flash() {
Qst.verify(File.exists(uniflash.program), uniflash.program + " not found. Check 'installPath' property.");
Qst.verify(File.exists(file), file + " not found. Check 'file' property.");
Qst.verify(File.exists((installPath
+ "/deskdb/content/TICloudAgent/linux/ccs_base/common/targetdb/devices/"
+ "/deskdb/content/TICloudAgent/" + host + "/ccs_base/common/targetdb/devices/"
+ device + ".xml")), "No db entry for device '"+ device + "' found in '"
+ installPath + "/deskdb/content/TICloudAgent/linux/ccs_base/common/targetdb/devices/" + "'.");
+ installPath + "/deskdb/content/TICloudAgent/" + host + "/ccs_base/common/targetdb/devices/" + "'.");

var configFilePath = test.workingDirectory + "/uniflashprobe"
+ "-" + device
Expand Down Expand Up @@ -55,6 +57,11 @@ Component {
return reset.waitForFinished(Math.max(milliseconds - (t1 - t0), -1));
}

function reset() {
reset.start();
reset.waitForStarted(200);
}

ProcessProbe {
id: uniflash

Expand All @@ -64,8 +71,6 @@ Component {
Qst.compare(exitCode, 0, "UniflashProbe '" + root.name
+ "' (dslite) exited with " + exitCode
+ ": " + readAllStandardError() + readAllStandardOutput());
reset.start();
reset.waitForStarted(100);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/launchpad-probe/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include <assert.h>
#include <stdlib.h>
#include <unistd.h>

#include <ti/drivers/PIN.h>
#include <ti/drivers/Power.h>
Expand All @@ -37,6 +36,7 @@
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Mailbox.h>
#include <ti/sysbios/posix/unistd.h>

#include <protocols/roc.h>

Expand Down
2 changes: 1 addition & 1 deletion src/qst/qst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ QmlContext qmlDefinitionContext(const QObject* object)
QQmlData* data = QQmlData::get(object);
if (data && data->outerContext)
{
result["file"] = data->outerContext->url().path();
result["file"] = data->outerContext->url().toLocalFile();
result["line"] = data->lineNumber;
result["column"] = data->columnNumber;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"UniflashProbe": {
"installDirectory": "/opt/ti/uniflash_4.4.0"
},
"qstExecutable": "/opt/qst/bin/qst",
"qstExecutable": "qst",
"dut": {
"serial": "L400028Q",
"device": "cc1310f128",
Expand Down
18 changes: 18 additions & 0 deletions tests/manual/launchpadprobe/cc1310_launchxl_windows.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"UniflashProbe": {
"installDirectory": "C:/ti/uniflash_4.4.0"
},
"qstExecutable": "qst.exe",
"dut": {
"serial": "L400028Q",
"device": "cc1310f128",
"firmwarePath": "C:/qst/share/qst/firmware/launchpad-probe-CC1310_LAUNCHXL.elf",
"ioid": 13
},
"probe": {
"serial": "L20002HM",
"device": "cc1310f128",
"firmwarePath": "C:/qst/share/qst/firmware/launchpad-probe-CC1310_LAUNCHXL.elf",
"ioid": 23
}
}
4 changes: 3 additions & 1 deletion tests/manual/launchpadprobe/flash-firmware.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ LaunchpadProbeTest {
board2.flash();
board1.waitForFinished(maxFlashTime);
board2.waitForFinished(Math.max(maxFlashTime - test.elapsedTime, 0));
Qst.wait(666) // Otherwise the following test may not connect properly
board1.reset()
board2.reset()
Qst.wait(666) // Need to wait before the next test can access the board
}
}
4 changes: 2 additions & 2 deletions tests/manual/launchpadprobe/launchpadprobe.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ QstAutoTest {
"LaunchpadProbeTest.qml",
"benchmark-response-time.qml",
"BoardConfig.qml",
"cc1310_launchxl.json",
"cc1310_launchxl_linux.json",
"cc1310_launchxl_windows.json",
"flash-firmware.qml",
"pinprobe-read-write.qml",
"reset.qml",
"test-launchpadprobe.cpp",
"test-launchpadprobe.h",
"watchdog-dut.qml",
"watchdog.qml",
]
Expand Down
90 changes: 57 additions & 33 deletions tests/manual/launchpadprobe/test-launchpadprobe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,55 +21,79 @@
**
** $END_LICENSE$
****************************************************************************/
#include "test-launchpadprobe.h"
#include <qst.h>
#include <qtest.h>
#include <qsttestresults.h>

QString LaunchpadProbeTest::dataPath(const QString &fileName) const
#include <qsttest.h>

#include <QtCore/QtGlobal>
#include <QtCore/QObject>
#include <QtTest/QtTest>

class test_launchpadprobe : public QstTest
{
Q_OBJECT

public:
QString dataPath(const QString &fileName) const;

private slots:
void init();
void flashFirmware();
void pinProbereadWrite();
void benchmarkPinProbeResponseTime();
void pinProbeWatchdog();

private:
QString profile() const;
};

QString test_launchpadprobe::profile() const
{
#ifdef Q_OS_WIN
return "cc1310_launchxl_windows";
#elif defined Q_OS_LINUX
return "cc1310_launchxl_linux";
#endif
}

void test_launchpadprobe::init()
{
setTimeoutMs(25000);
}

QString test_launchpadprobe::dataPath(const QString &fileName) const
{
return QDir(QString(SOURCE_DIR)).absoluteFilePath(fileName);
}

void LaunchpadProbeTest::flashFirmware()
void test_launchpadprobe::flashFirmware()
{
QstTestResults results = execQstRun(QStringList{ "-f", dataPath("flash-firmware.qml"), "-p", "cc1310_launchxl" }, 25000);
if (qstProcess().exitCode() != 0)
{
QFAIL(qstProcess().readAllStandardError());
}
VERIFY_PASS(results, "flash-firmware");
RUN_AND_EXPECT(qst::ExitNormal, "-f", dataPath("flash-firmware.qml"), "-p", profile());
VERIFY_PASS(results(), "flash-firmware");
}

void LaunchpadProbeTest::pinProbereadWrite()
void test_launchpadprobe::pinProbereadWrite()
{
QstTestResults results = execQstRun(QStringList{ "-f", dataPath("pinprobe-read-write.qml"), "-p", "cc1310_launchxl" }, 25000);
if (qstProcess().exitCode() != 0)
{
QFAIL(qstProcess().readAllStandardError());
}
VERIFY_PASS(results, "pinprobe-read-write");
RUN_AND_EXPECT(qst::ExitNormal, "-f", dataPath("pinprobe-read-write.qml"), "-p", profile());
VERIFY_PASS(results(), "pinprobe-read-write");

}

void LaunchpadProbeTest::benchmarkPinProbeResponseTime()
void test_launchpadprobe::benchmarkPinProbeResponseTime()
{
QstTestResults results = execQstRun(QStringList{ "-f", dataPath("benchmark-response-time.qml"), "-p", "cc1310_launchxl" }, 25000);
if (qstProcess().exitCode() != 0)
{
QFAIL(qstProcess().readAllStandardError());
}
VERIFY_PASS(results, "benchmark-response-time");
RUN_AND_EXPECT(qst::ExitNormal, "-f", dataPath("benchmark-response-time.qml"), "-p", profile());
VERIFY_PASS(results(), "benchmark-response-time");

}

void LaunchpadProbeTest::pinProbeWatchdog()
void test_launchpadprobe::pinProbeWatchdog()
{
{
QstTestResults results = execQstRun(QStringList{ "-f", dataPath("watchdog.qml"), "-p", "cc1310_launchxl" }, 25000);
if (qstProcess().exitCode() != 0)
{
QFAIL(qstProcess().readAllStandardError());
}
VERIFY_PASS(results, "watchdog");
}
RUN_AND_EXPECT(qst::ExitNormal, "-f", dataPath("watchdog.qml"), "-p", profile());
VERIFY_PASS(results(), "watchdog");
}

QTEST_GUILESS_MAIN(LaunchpadProbeTest)
QTEST_GUILESS_MAIN(test_launchpadprobe)

#include "test-launchpadprobe.moc"
47 changes: 0 additions & 47 deletions tests/manual/launchpadprobe/test-launchpadprobe.h

This file was deleted.

24 changes: 18 additions & 6 deletions tests/manual/launchpadprobe/watchdog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ LaunchpadProbeTest {
property int pingIntervalMs: 517
property int timeUntilDutKillMs: Math.ceil(Math.random() * connectionTimeoutMs) + 100

// Shows the DUT's connected state
PinProbe {
name: "connected-led"
id: connectedLed
Expand All @@ -18,6 +19,7 @@ LaunchpadProbeTest {
port: Xds.portFromSerial(profile.probe.serial)
}

// Shows the DUT's activity
PinProbe {
name: "activity-led"
id: activityLed
Expand All @@ -28,6 +30,7 @@ LaunchpadProbeTest {
port: Xds.portFromSerial(profile.probe.serial)
}

// Another qst instance accessing the DUT board
ProcessProbe {
id: dutQstProcess
name: "dut-qst-process"
Expand Down Expand Up @@ -79,20 +82,29 @@ LaunchpadProbeTest {
endOn: dutDisconnected

minDuration: (connectionTimeoutMs - pingIntervalMs)
maxDuration: connectionTimeoutMs
maxDuration: (connectionTimeoutMs + pingIntervalMs)
}

function run() {
// The DUT must not be in connected state
Qst.compare(connectedLed.value, PinProbe.Low)
// Start another qst application that connects to the DUT
dutQstProcess.start()
Qst.wait(100)
Qst.wait(300)
// The DUT must now be in connected state
Qst.compare(connectedLed.value, PinProbe.High)

// Kill the Qst DUT instance after some time to
// trigger a watchdog reset
Qst.wait(timeUntilDutKillMs)
dutQstProcess.terminate()
dutKilled()
dutQstProcess.waitForFinished(100)
Qst.compare(dutQstProcess.state, ProcessProbe.NotRunning)
Qst.wait(connectionTimeoutMs * 2)

// Wait for the termination propagate
dutQstProcess.waitForFinished(300)
// Qst.compare(dutQstProcess.state, ProcessProbe.NotRunning)

// Wait and ensure that the DUT resets
Qst.wait(connectionTimeoutMs + (2*pingIntervalMs))
Qst.compare(connectedLed.value, PinProbe.Low)
}
}
5 changes: 5 additions & 0 deletions tests/qsttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ QString QstTest::dataPath(const QString& directory) const
return m_dataDirectory.absoluteFilePath(directory);
}

void QstTest::setTimeoutMs(int milliseconds)
{
m_timeoutMs = milliseconds;
}

QstTestResults QstTest::execQstRun(const QStringList& arguments, int timeoutMs)
{
QStringList cmdLine = { "run", "--import", m_defaultImportPath };
Expand Down
Loading

0 comments on commit c47e72d

Please sign in to comment.