prepared for build in a docker instance on jenkins

master
Marc Wäckerlin 9 years ago
parent 7217ef6ac8
commit 9f3bafe5a1
  1. 4
      ChangeLog
  2. 28
      ax_check_qt.m4
  3. 12
      ax_init_standard_project.m4
  4. 123
      bootstrap.sh
  5. 54
      resolve-debbuilddeps.sh
  6. 10
      src/commands.hxx
  7. 8
      src/testgui.hxx
  8. 11
      src/testgui.ui

@ -1,3 +1,7 @@
2015-11-02 08:00 marc
* ChangeLog, debian/control.in: test requires xvfb-run
2015-11-02 00:01 marc 2015-11-02 00:01 marc
* AUTHORS, ChangeLog, bootstrap.sh, resolve-debbuilddeps.sh: new * AUTHORS, ChangeLog, bootstrap.sh, resolve-debbuilddeps.sh: new

@ -103,7 +103,12 @@ AC_DEFUN([AX_CHECK_QT], [
HAVE_$1=1 HAVE_$1=1
AC_DEFINE([HAVE_$1]) AC_DEFINE([HAVE_$1])
QTDIR=$(${PKG_CONFIG} --variable=prefix Qt5Core) QTDIR=$(${PKG_CONFIG} --variable=prefix Qt5Core)
qt_host_bins=$(${PKG_CONFIG} --variable=host_bins Qt5Core)
if test -d "${qt_host_bins}"; then
QT_PLUGIN_PATH=${qt_host_bins}/../plugins
else
QT_PLUGIN_PATH=${QTDIR}/share/qt5/plugins QT_PLUGIN_PATH=${QTDIR}/share/qt5/plugins
fi
MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}" MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}"
[$1]_CPPFLAGS="${[$1]5_CFLAGS}" [$1]_CPPFLAGS="${[$1]5_CFLAGS}"
[$1]_CXXFLAGS="${[$1]5_CFLAGS}" [$1]_CXXFLAGS="${[$1]5_CFLAGS}"
@ -145,7 +150,12 @@ AC_DEFUN([AX_CHECK_QT], [
HAVE_$1=1 HAVE_$1=1
AC_DEFINE([HAVE_$1]) AC_DEFINE([HAVE_$1])
QTDIR=$(${PKG_CONFIG} --variable=prefix QtCore) QTDIR=$(${PKG_CONFIG} --variable=prefix QtCore)
qt_host_bins=$(${PKG_CONFIG} --variable=host_bins QtCore)
if test -d "${qt_host_bins}"; then
QT_PLUGIN_PATH=${qt_host_bins}/../plugins
else
QT_PLUGIN_PATH=${QTDIR}/share/qt/plugins QT_PLUGIN_PATH=${QTDIR}/share/qt/plugins
fi
MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}" MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}"
[$1]_CPPFLAGS="${[$1]_CFLAGS}" [$1]_CPPFLAGS="${[$1]_CFLAGS}"
[$1]_CXXFLAGS="${[$1]_CFLAGS}" [$1]_CXXFLAGS="${[$1]_CFLAGS}"
@ -188,6 +198,16 @@ AC_DEFUN([AX_CHECK_QT], [
if test -n "${MINGW}"; then if test -n "${MINGW}"; then
AX_CHECK_VALID_CXX_FLAG([-Wl,-subsystem,windows], [windows console flag]) AX_CHECK_VALID_CXX_FLAG([-Wl,-subsystem,windows], [windows console flag])
fi fi
test "x$prefix" = xNONE && prefix=$ac_default_prefix
if test "${QT_PLUGIN_PATH}" = "${QT_PLUGIN_PATH#${prefix}}"; then
QT_PLUGIN_PATH=${prefix}${QT_PLUGIN_PATH#/usr}
fi
AC_ARG_WITH([qt-plugin-path],
[AS_HELP_STRING([--with-qt-plugin-path=PATH],
[define a different qt plugin path, current @<:@default=check@:>@])],
[QT_PLUGIN_PATH=$with_qt_plugin_path],
[])
AC_MSG_NOTICE([Qt Plugins are installed to ${QT_PLUGIN_PATH}])
AC_SUBST(QTDIR) AC_SUBST(QTDIR)
AC_SUBST(QT_PLUGIN_PATH) AC_SUBST(QT_PLUGIN_PATH)
AC_SUBST(CPPFLAGS) AC_SUBST(CPPFLAGS)
@ -214,10 +234,10 @@ qrc_%.cxx: %.qrc
%.qm: %.ts %.qm: %.ts
${LRELEASE} $< -qm [$][@] ${LRELEASE} $< -qm [$][@]
#%.ts: ${LANGUAGE_FILES:%=%} %.ts: ${LANGUAGE_FILES:%=%}
# ${LUPDATE} -no-obsolete \ ${LUPDATE} -no-obsolete \
# -target-language ${@:${LANGUAGE_FILE_BASE}_%.ts=%} \ -target-language ${@:${LANGUAGE_FILE_BASE}_%.ts=%} \
# -ts [$][@] $< -ts [$][@] $<
']) '])

@ -696,3 +696,15 @@ AC_DEFUN([AX_CHECK_VALID_LD_FLAG], [
AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS)
AC_MSG_RESULT([$newflag in $LDFLAGS]) AC_MSG_RESULT([$newflag in $LDFLAGS])
]) ])
# Check if a package exists in the current distribution, if yes, require it
# in debian/control.in append @DEB_DEPEND_IFEXISTS@ to Build-Depends
# - parameter:
# $1 = package name
AC_DEFUN([AX_DEB_DEPEND_IFEXISTS], [
pkg=$1
if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then
DEB_DEPEND_IFEXISTS+=", ${pkg}"
fi
AC_SUBST(DEB_DEPEND_IFEXISTS)
])

@ -240,15 +240,29 @@ done
HEADER='## @id '"\$Id\$"' HEADER='## @id '"\$Id\$"'
# ##
# This file has been added by '${MY_NAME}' on '$(LANG= date +"%a, %d %B %Y %H:%M:%S %z")' ## This file has been added:
# Feel free to change it or even remove and rebuild it, up to your needs ## - by '${MY_NAME}'
# ## - on '$(LANG= date +"%a, %d %B %Y %H:%M:%S %z")'
## Feel free to change it or even remove and rebuild it, up to your needs
##
## 1 2 3 4 5 6 7 8 ## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890
' '
CHEADER='/** @id '"\$Id\$"'
This file has been added:
- by '${MY_NAME}'
- on '$(LANG= date +"%a, %d %B %Y %H:%M:%S %z")'
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
'
notice() { notice() {
echo -e "\e[1;33m$*\e[0m" echo -e "\e[1;33m$*\e[0m"
} }
@ -436,12 +450,19 @@ AX_INIT_STANDARD_PROJECT
# create output # create output
AC_OUTPUT AC_OUTPUT
EOF EOF
PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac) PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac)
SAVEIFS="$IFS"
IFS="-" PackageName=( $PACKAGE_NAME )
IFS="$SAVEIFS"
PackageName=${PackageName[*]^}
PackageName=${PackageName// /}
if ! testtag "AX_CHECK_QT" configure.ac && \ if ! testtag "AX_CHECK_QT" configure.ac && \
! testtag "AX_REQUIRE_QT" configure.ac; then ! testtag "AX_REQUIRE_QT" configure.ac; then
echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | \ echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | \
to --condition AX_USE_CXX src/makefile.am to --condition AX_USE_CXX src/makefile.am
else elif ! test -e src/makefile.am; then
to --condition AX_USE_CXX src/makefile.am <<EOF to --condition AX_USE_CXX src/makefile.am <<EOF
${HEADER}bin_PROGRAMS = ${PACKAGE_NAME} ${HEADER}bin_PROGRAMS = ${PACKAGE_NAME}
@ -475,7 +496,7 @@ ${PACKAGE_NAME//-/_}_UIFILES = ui_${PACKAGE_NAME}.hxx
## list all %.qrc resource files as qrc_%.cxx ## list all %.qrc resource files as qrc_%.cxx
## note: if there exists a directory %, the file %.qrc is generated from that ## note: if there exists a directory %, the file %.qrc is generated from that
${PACKAGE_NAME//-/_}_RESOURCES = qrc_languages.cxx qrc_resources.cxx ${PACKAGE_NAME//-/_}_RESOURCES = qrc_languages.cxx # qrc_resources.cxx
## list all final translation files, list all supported languages here ## list all final translation files, list all supported languages here
${PACKAGE_NAME//-/_}_TRANSLATIONS = \${LANGUAGE_FILE_BASE}_en.qm \\ ${PACKAGE_NAME//-/_}_TRANSLATIONS = \${LANGUAGE_FILE_BASE}_en.qm \\
@ -487,7 +508,7 @@ ${PACKAGE_NAME//-/_}_TRANSLATIONS = \${LANGUAGE_FILE_BASE}_en.qm \\
${PACKAGE_NAME//-/_}_TR_FILES = main.cxx version.cxx ${PACKAGE_NAME//-/_}_TR_FILES = main.cxx version.cxx
## automatic assembly, no need to change ## automatic assembly, no need to change
${PACKAGE_NAME//-/_}_SOURCES = ${swisssign_pin_entry_TR_FILES} ${BUILT_SOURCES} ${PACKAGE_NAME//-/_}_SOURCES = \${${PACKAGE_NAME//-/_}_TR_FILES} \${BUILT_SOURCES}
## automatic assembly, no need to change ## automatic assembly, no need to change
BUILT_SOURCES = \${${PACKAGE_NAME//-/_}_MOCFILES} \ BUILT_SOURCES = \${${PACKAGE_NAME//-/_}_MOCFILES} \
@ -510,6 +531,89 @@ EXTRA_DIST = \${EXTRA_DIST_TR} \
LANGUAGE_FILES = \${EXTRA_DIST_TR} \${${PACKAGE_NAME//-/_}_TR_FILES} LANGUAGE_FILES = \${EXTRA_DIST_TR} \${${PACKAGE_NAME//-/_}_TR_FILES}
MAINTAINERCLEANFILES = makefile.in MAINTAINERCLEANFILES = makefile.in
EOF
to --condition AX_USE_CXX src/main.cxx <<EOF
${CHEADER}#include <${PACKAGE_NAME}.hxx>
#include <QApplication>
#include <QCommandLineParser>
#include <iostream>
int main(int argc, char *argv[]) try {
QApplication a(argc, argv);
QCommandLineParser parser;
parser.addHelpOption();
parser.process(a);
QStringList scripts(parser.positionalArguments());
${PackageName} w;
w.show();
return a.exec();
} catch (std::exception &x) {
std::cerr<<"**** error: "<<x.what()<<std::endl;
return 1;
}
EOF
to --condition AX_USE_CXX src/${PACKAGE_NAME}.hxx <<EOF
${CHEADER}#ifndef ${PackageName^^}_HXX
#define ${PackageName^^}_HXX
#include <QMainWindow>
#include <ui_${PACKAGE_NAME}.hxx>
/// Main Window
/** Main window for ${PACKAGE_NAME} */
class ${PackageName}: public QMainWindow, protected Ui::${PackageName} {
Q_OBJECT;
public:
explicit ${PackageName}(QWidget *parent = 0): QMainWindow(parent) {
setupUi(this);
}
virtual ~${PackageName}() {}
};
#endif
EOF
to --condition AX_USE_CXX src/${PACKAGE_NAME}.ui <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>${PackageName}</class>
<widget class="QMainWindow" name="${PackageName}">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>${PackageName}</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
EOF
to --condition AX_USE_CXX src/languages.qrc <<EOF
<RCC>
<qresource prefix="/language">
<file>${PACKAGE_NAME}_de.qm</file>
<file>${PACKAGE_NAME}_fr.qm</file>
<file>${PACKAGE_NAME}_it.qm</file>
<file>${PACKAGE_NAME}_en.qm</file>
</qresource>
</RCC>
EOF EOF
fi fi
to --condition AX_USE_CXX src/version.hxx <<EOF to --condition AX_USE_CXX src/version.hxx <<EOF
@ -698,12 +802,11 @@ if testtag AX_USE_DEBIAN_PACKAGING; then
-- @AUTHOR@ @BUILD_DATE@ -- @AUTHOR@ @BUILD_DATE@
EOF EOF
BUILD_DEPENDS="debhelper, subversion, pkg-config, automake, libtool, autotools-dev, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | qt4-default | qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)"
to debian/control.in <<EOF to debian/control.in <<EOF
Source: @PACKAGE_NAME@ Source: @PACKAGE_NAME@
Priority: extra Priority: extra
Maintainer: @AUTHOR@ Maintainer: @AUTHOR@
Build-Depends: ${BUILD-DEPENDS} Build-Depends: debhelper, subversion, pkg-config, autotools-dev, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | qt4-default | qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)
Package: @PACKAGE_NAME@ Package: @PACKAGE_NAME@
Section: $(if testtag AX_USE_LIBTOOL; then echo "libs"; fi) Section: $(if testtag AX_USE_LIBTOOL; then echo "libs"; fi)
@ -717,7 +820,7 @@ $( if testtag AX_USE_LIBTOOL; then
Package: @PACKAGE_NAME@-dev Package: @PACKAGE_NAME@-dev
Section: libdevel Section: libdevel
Architecture: any Architecture: any
Depends: @PACKAGE_NAME@ (= \${binary:Version}), ${BUILD-DEPENDS} Depends: @PACKAGE_NAME@ (= \${binary:Version})
Description: @DESCRIPTION@ - Development Package Description: @DESCRIPTION@ - Development Package
@README_DEB@ @README_DEB@
EOF2 EOF2

@ -12,36 +12,62 @@
SCHROOTNAME="$1" SCHROOTNAME="$1"
sed 's,@[^@]*@, dummytext,g' debian/control.in > debian/control function install() {
if test -n "${SCHROOTNAME}"; then
if schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install $*; then
return 0
fi
else
if apt-get -y install $*; then
return 0
fi
fi
}
TO_INSTALL=
if test -e debian/control.in -a ! -e debian/control; then
for f in $(sed -n 's, *AX_DEB_DEPEND_IFEXISTS(\([^)]*\)).*,\1,p' configure.ac); do
if test -n "$(apt-cache policy -q ${f})" && ! dpkg -l "${f}"; then
TO_INSTALL+=" ${f}"
fi
done
trap "rm debian/control" INT TERM EXIT
sed 's,@DEB_DEPEND_IFEXISTS@,,g' debian/control.in | \
sed 's,@[^@]*@, dummytext,g' > debian/control
fi
if test -n "${SCHROOTNAME}"; then if test -n "${SCHROOTNAME}"; then
schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get install -y dpkg-dev schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install dpkg-dev
DEPS=$(schroot -c "${SCHROOTNAME}" -- dpkg-checkbuilddeps 2>&1 || true) DEPS=$(schroot -c "${SCHROOTNAME}" -- dpkg-checkbuilddeps 2>&1 || true)
else else
sudo apt-get install -y dpkg-dev apt-get -y install dpkg-dev
sudo apt-get update
DEPS=$(dpkg-checkbuilddeps 2>&1 || true) DEPS=$(dpkg-checkbuilddeps 2>&1 || true)
fi fi
DEPS=$(echo "$DEPS" | sed -n '/Unmet build dependencies/ { s,.*Unmet build dependencies: ,,g; s, ([^)]*),,g; s, *| *,|,g; p}') DEPS=$(echo "$DEPS" | sed -n '/Unmet build dependencies/ { s,.*Unmet build dependencies: ,,g; s, ([^)]*),,g; s, *| *,|,g; p}')
for pa in ${DEPS}; do for pa in ${DEPS}; do
success=0 if test ${pa//|/} = ${pa}; then
for p in $(echo "${pa}" | sed 's,|, ,g'); do TO_INSTALL+=" ${pa}"
if test -n "${SCHROOTNAME}"; then continue;
if schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install ${p}; then
success=1
break;
fi fi
else success=0
if sudo apt-get -y install ${p}; then for p in ${pa//|/ }; do
if install ${TO_INSTALL} ${p}; then
TO_INSTALL+=" ${p}"
success=1 success=1
break; break
fi
fi fi
done done
if test ${success} -eq 0; then if test ${success} -eq 0; then
echo "**** Error: Installation Failed: ${pa}" echo "**** Error: Installation Failed: ${pa}"
exit 1
fi fi
done done
if test -n "${TO_INSTALL}" && ! install ${TO_INSTALL}; then
echo "**** Error: Installation Failed: ${TO_INSTALL}"
exit 1
fi
echo "**** Success: All Dependencies Resolved" echo "**** Success: All Dependencies Resolved"

@ -440,14 +440,15 @@ class Script: public QObject {
.replace("&nbsp;", " ").replace("&amp;", "&"); .replace("&nbsp;", " ").replace("&amp;", "&");
} }
public: public:
Script(): _clicktype(JAVASCRIPT_CLICK), _command(0) { Script(): _clicktype(JAVASCRIPT_CLICK), _command(0), _screenshots(true) {
initPrototypes(); initPrototypes();
} }
Script(const Script& o): Script(const Script& o):
QObject(), QObject(),
_prototypes(o._prototypes), _prototypes(o._prototypes),
_script(o._script), _script(o._script),
_command(0) { _command(0),
_screenshots(true) {
set(o); set(o);
} }
QString syntax() const { QString syntax() const {
@ -2363,8 +2364,11 @@ class : public Command {
*/ */
inline bool Screenshot::execute(Script* script, QWebFrame* frame) { inline bool Screenshot::execute(Script* script, QWebFrame* frame) {
if (!script->screenshots()) return true;
Logger log(this, script); Logger log(this, script);
if (!script->screenshots()) {
log("screenshots disabled");
return true;
}
QString filename(screenshot(line(), script->targetdir(), QString filename(screenshot(line(), script->targetdir(),
script->testclass(), script->testclass(),
script->replacevars(_filename), frame)); script->replacevars(_filename), frame));

@ -123,13 +123,15 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI {
if (_setupscriptactive->isEnabled() if (_setupscriptactive->isEnabled()
&& _setupscriptactive->isChecked()) { && _setupscriptactive->isChecked()) {
script.parse(_setupscript->toPlainText().split('\n'), "setup"); script.parse(_setupscript->toPlainText().split('\n'), "setup");
script.run(_web->page()->mainFrame(), testsuites, QString(), false); script.run(_web->page()->mainFrame(), testsuites, QString(),
_screenshots->isChecked());
script.reset(); script.reset();
} }
QString text(_testscript->textCursor().selection().toPlainText()); QString text(_testscript->textCursor().selection().toPlainText());
if (text.isEmpty()) text = _testscript->toPlainText(); if (text.isEmpty()) text = _testscript->toPlainText();
script.parse(text.split('\n'), "script"); script.parse(text.split('\n'), "script");
script.run(_web->page()->mainFrame(), testsuites, QString(), false); script.run(_web->page()->mainFrame(), testsuites, QString(),
_screenshots->isChecked());
} catch (std::exception &x) { } catch (std::exception &x) {
QMessageBox::critical(this, tr("Script Failed"), QMessageBox::critical(this, tr("Script Failed"),
tr("Script failed with message:\n%1") tr("Script failed with message:\n%1")
@ -226,7 +228,7 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI {
script.run(page.mainFrame(), testsuites, QString(), false); script.run(page.mainFrame(), testsuites, QString(), false);
_setupScript.cleanup(); _setupScript.cleanup();
_setupScript.parse(_setupscript->toPlainText().split('\n'), "setup"); _setupScript.parse(_setupscript->toPlainText().split('\n'), "setup");
_setupScript.run(page.mainFrame(), testsuites, QString(), false);; _setupScript.run(page.mainFrame(), testsuites, QString(), false);
_setupscriptstatus->setText(trUtf8("")); _setupscriptstatus->setText(trUtf8(""));
_setupscriptactive->setEnabled(true); _setupscriptactive->setEnabled(true);
} catch (std::exception &x) { } catch (std::exception &x) {

@ -399,7 +399,7 @@ this.dispatchEvent(evObj);</string>
</attribute> </attribute>
<widget class="QWidget" name="dockWidgetContents_12"> <widget class="QWidget" name="dockWidgetContents_12">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="3"> <item row="0" column="0" rowspan="4">
<widget class="QPlainTextEdit" name="_testscript"/> <widget class="QPlainTextEdit" name="_testscript"/>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
@ -422,7 +422,7 @@ this.dispatchEvent(evObj);</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -435,6 +435,13 @@ this.dispatchEvent(evObj);</string>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="1">
<widget class="QCheckBox" name="_screenshots">
<property name="text">
<string>Screenshots</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

Loading…
Cancel
Save