c290fda6e5
Red Bear OS Team
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#include <QCoreApplication>
|
|
#include <QDebug>
|
|
#include <QPluginLoader>
|
|
|
|
#include <cstdio>
|
|
#include <fstream>
|
|
|
|
static constexpr const char *PhaseFile = "/home/root/.qt6-plugin-check.phase";
|
|
|
|
static void mark(const char *value) {
|
|
std::ofstream out(PhaseFile, std::ios::trunc);
|
|
out << value << '\n';
|
|
out.flush();
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
mark("before-qcoreapplication");
|
|
std::fprintf(stderr, "qt6-plugin-check before QCoreApplication\n");
|
|
std::fflush(stderr);
|
|
QCoreApplication app(argc, argv);
|
|
mark("after-qcoreapplication");
|
|
std::fprintf(stderr, "qt6-plugin-check after QCoreApplication\n");
|
|
std::fflush(stderr);
|
|
|
|
const QString plugin = argc > 1
|
|
? QString::fromLocal8Bit(argv[1])
|
|
: QStringLiteral("/usr/plugins/platforms/libqminimal.so");
|
|
|
|
QPluginLoader loader(plugin);
|
|
mark("before-metadata");
|
|
std::fprintf(stderr, "qt6-plugin-check before metadata\n");
|
|
std::fflush(stderr);
|
|
qInfo() << "qt6-plugin-check file" << plugin;
|
|
qInfo() << "qt6-plugin-check metaData" << loader.metaData();
|
|
|
|
mark("before-load");
|
|
std::fprintf(stderr, "qt6-plugin-check before load\n");
|
|
std::fflush(stderr);
|
|
if (!loader.load()) {
|
|
mark("load-failed");
|
|
qWarning() << "qt6-plugin-check load failed" << loader.errorString();
|
|
return 1;
|
|
}
|
|
|
|
QObject *instance = loader.instance();
|
|
if (!instance) {
|
|
mark("instance-failed");
|
|
qWarning() << "qt6-plugin-check instance failed" << loader.errorString();
|
|
return 2;
|
|
}
|
|
|
|
mark("instance-ok");
|
|
std::fprintf(stderr, "qt6-plugin-check instance ok\n");
|
|
std::fflush(stderr);
|
|
qInfo() << "qt6-plugin-check instance ok" << instance->metaObject()->className();
|
|
return 0;
|
|
}
|