aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qnx/qnxdevicetester.h
blob: 9f1b7e6754158cd40e02d7074c7fafdea8fb87a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (C) 2016 BlackBerry Limited. All rights reserved.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <remotelinux/linuxdevicetester.h>
#include <utils/qtcprocess.h>

#include <QStringList>

namespace Qnx {
namespace Internal {

class QnxDeviceTester : public ProjectExplorer::DeviceTester
{
    Q_OBJECT

public:
    explicit QnxDeviceTester(QObject *parent = nullptr);

    void testDevice(const ProjectExplorer::IDevice::Ptr &deviceConfiguration) override;
    void stopTest() override;

private:
    enum State {
        Inactive,
        GenericTest,
        VarRunTest,
        CommandsTest
    };

    void handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult result);
    void handleProcessDone();
    void handleVarRunDone();
    void handleCommandDone();

    void testNextCommand();
    void setFinished(ProjectExplorer::DeviceTester::TestResult result);

    QStringList versionSpecificCommandsToTest(int versionNumber) const;

    RemoteLinux::GenericLinuxDeviceTester *m_genericTester;
    ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration;
    ProjectExplorer::DeviceTester::TestResult m_result = TestSuccess;
    State m_state = Inactive;

    int m_currentCommandIndex = 0;
    QStringList m_commandsToTest;
    Utils::QtcProcess m_process;
};

} // namespace Internal
} // namespace Qnx