diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index f487c68..4128d9f 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -181,6 +181,8 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ _AM_SUBST_NOTMAKE([AUTHOR]) DISTRO=$(lsb_release -sc 2>/dev/null || uname -s 2>/dev/null) AX_SUBST(DISTRO) + ARCH=$((@<:@@<:@ $(uname -sm) =~ 64 @:>@@:>@ && echo amd64) || (@<:@@<:@ $(uname -sm) =~ 'i?86' @:>@@:>@ && echo i386 || uname -sm)) + AX_SUBST(ARCH) DISTRIBUTOR=$(lsb_release -si 2>/dev/null || uname -s 2>/dev/null) case "${DISTRIBUTOR// /-}" in (Ubuntu) UBUNTU=1; AX_SUBST(UBUNTU);; diff --git a/bootstrap.sh b/bootstrap.sh index de16e6d..22e0c7b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -31,8 +31,9 @@ while test $# -gt 0; do (--configure|-c) configure=1;; (--docker|-d) docker=1;; (--build|-b) configure=1; build=1; buildtarget+=" distcheck";; - (--target|-t) shift; configure=1; build=1; buildtarget+=" $1";; + (--all|-a) shift; configure=1; build=1; buildtarget+=" all";; (--clean) shift; configure=1; build=1; buildtarget+=" maintainer-clean";; + (--target|-t) shift; configure=1; build=1; buildtarget+=" $1";; (--overwrite|-o) overwrite=1;; (--rebuild|-r) rebuild=1;; (--rebuild-file|-f) shift; rebuildfiles+=("$1");; @@ -51,6 +52,8 @@ OPTIONS --configure, -c call ./configure after initialization --docker, -d build and run tests in a docker instance --build, -b build, also call ./configure && make distcheck + --all, -a same as -b, but make target all + --clean same as -b, but make target maintainer-clean --target, -t same as -b, but specify target instead of distcheck --overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros) --rebuild, -r force rebuild of generated files, even if modified @@ -129,6 +132,7 @@ GENERATED FILES * resolve-debbuilddeps.sh - script to install debian package dependencies * resolve-rpmbuilddeps.sh - script to install RPM package dependencies * build-in-docker.sh - script to build the project encapsulated in a docker container + * build-in-docker.conf - additional configuration for build-in-docker.sh * build-resource-file.sh - build resource.qrc file from a resource directory * sql-to-dot.sed - script to convert SQL schema files to graphviz dot in doxygen * mac-create-app-bundle.sh - script to create apple mac os-x app-bundle @@ -1162,6 +1166,12 @@ Libs: -L\${libdir} -l${PACKAGE_NAME#lib} @LDFLAGS@ Cflags: -I\${includedir} @CPPFLAGS@ Requires: @PKG_REQUIREMENTS@ EOF +to build-in-docker.conf <&1 | sed -n 's, is needed by.*,,p') if test -n "${FILES}"; then + FIRST=$(echo "${FILES}" | egrep -o "${PKGCONFIGS// /|}") + if test -n "${FIRST}"; then + schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FIRST} || \ + schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FIRST} || \ + schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FIRST} + fi schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FILES} || \ schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FILES} || \ schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FILES} @@ -23,6 +30,12 @@ if test -n "${SCHROOTNAME}"; then else FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p') if test -n "${FILES}"; then + FIRST=$(echo "${FILES}" | egrep -o "${PKGCONFIGS// /|}") + if test -n "${FIRST}"; then + yum install -y ${FIRST} || \ + zypper install -y ${FIRST} || \ + dnf install -y ${FIRST} + fi yum install -y ${FILES} || \ zypper install -y ${FILES} || \ dnf install -y ${FILES} diff --git a/scripts/90wt-mode.wt b/scripts/90wt-mode.wt new file mode 100644 index 0000000..fa07712 --- /dev/null +++ b/scripts/90wt-mode.wt @@ -0,0 +1,9 @@ +;; -*-emacs-lisp-*- +;; +;; Emacs startup file for the Debian GNU/Linux wt-mode package +;; + +;; Set up to autoload +(autoload 'wt-mode "wt-mode" "Major mode for editing Webtester test scripts" t) +(setq auto-mode-alist + (cons '("\\.wt\\'" . wt-mode) auto-mode-alist)) diff --git a/scripts/makefile.am b/scripts/makefile.am index 57c33c5..2eeff34 100644 --- a/scripts/makefile.am +++ b/scripts/makefile.am @@ -8,5 +8,11 @@ dist_bin_SCRIPTS = doxygen-webtester.sed +emacsdir = ${datadir}/emacs/site-lisp +dist_emacs_SCRIPTS = wt-mode.el + +emacsconfdir = ${sysconfdir}/emacs/site-start.d +dist_emacsconf = 90wt-mode.el + MAINTAINERCLEANFILES = makefile.in diff --git a/scripts/wt-mode.el b/scripts/wt-mode.el new file mode 100644 index 0000000..7bfff71 --- /dev/null +++ b/scripts/wt-mode.el @@ -0,0 +1,48 @@ +;; Define an Emacs Mode for Webtester +;; +;; Features: +;; - indentation support +;; - syntax highlighting +;; +;; Documentations: +;; - mode tutorial: +;; https://www.emacswiki.org/emacs/ModeTutorial +;; - faces for font lock: +;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html + +(defvar wt-mode-hook nil) + +(defvar wt-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-j" 'newline-and-indent) + map) + "Newline and indent") + +(add-to-list 'auto-mode-alist '("\\.wt\\'" . wt-mode)) + + +;; get all keywords: +;; echo $(webrunner -h | sed -n 's, COMMAND: ,,p') | sed 's, ,\\\\|,g' +(defconst wt-font-lock-keywords + (list + '("^ *\\(ca-certificate\\|call\\|case\\|check\\|clear-cookies\\|click\\|clicktype\\|client-certificate\\|do\\|download\\|echo\\|execute\\|exists\\|exit\\|expect\\|fail\\|for\\|function\\|if\\|ignoreto\\|include\\|label\\|load\\|not\\|offline-storage-path\\|open\\|screenshot\\|set\\|setvalue\\|sleep\\|testcase\\|testsuite\\|timeout\\|unset\\|upload\\)" . font-lock-builtin-face) + '("^ *#.*$" . font-lock-comment-face)) + "Highlighting expressions for Webtester") + +(defvar wt-mode-syntax-table + (let ((st (make-syntax-table))) + st) + "Syntax table for wt-mode") + +(defun wt-mode () + "Major mode for editing Webtester test scripts" + (interactive) + (kill-all-local-variables) + (set-syntax-table wt-mode-syntax-table) + (use-local-map wt-mode-map) + (set (make-local-variable 'font-lock-defaults) '(wt-font-lock-keywords)) + (setq major-mode 'wt-mode) + (setq mode-name "Webtester") + (run-hooks 'wpdl-mode-hook)) + +(provide 'wt-mode) diff --git a/src/commands.hxx b/src/commands.hxx index 7ffb296..f06bad7 100644 --- a/src/commands.hxx +++ b/src/commands.hxx @@ -176,7 +176,8 @@ class Command: public QObject { QStringList subCommandBlock(QStringList& in) { QStringList commands; int pos(-1); - while (in.size() && in[0].size() && in[0][0]==' ') { + while (in.size() && in[0].size() && in[0][0]==' ' + && pos<=(signed)in[0].toStdString().find_first_not_of(' ')) { if (pos<0) pos=in[0].toStdString().find_first_not_of(' '); commands += in.takeFirst().mid(pos); } @@ -805,6 +806,9 @@ class Script: public QObject { _rvariables.remove(_variables[name]); _variables.remove(name); } + QStringList functions() { + return _functions.keys(); + } void function(QString name, std::shared_ptr f) { _functions[name] = f; } @@ -826,7 +830,7 @@ class Script: public QObject { QString replacevars(QString txt) { for(QMap::iterator it(_variables.begin()); it!=_variables.end(); ++it) - txt.replace(it.key(), it.value()); + txt.replace(it.key(), it.value(), Qt::CaseSensitive); return txt; } QString insertvars(QString txt) { @@ -834,7 +838,7 @@ class Script: public QObject { it.toBack(); while (it.hasPrevious()) { it.previous(); - txt.replace(it.key(), it.value()); + txt.replace(it.key(), it.value(), Qt::CaseSensitive); } return txt; } @@ -1471,7 +1475,7 @@ class Execute: public Command { script.replaceInStrings(QRegularExpression("^"), " "); return tag()+" "+_command +(_args.size()?" "+_args.join(' '):QString()) - +(script.size()?"\n"+script.join("\n"):QString()); + +(script.size()?"\n "+script.join("\n "):QString()); } std::shared_ptr parse(Script*, QString args, QStringList& in, QString, int, int) { @@ -2096,8 +2100,8 @@ class If: public Command { "\n\n" "Execute commands conditionally. " "The first variant compares a variable to a value. " - "The comparision can be = ^ . ~ < >, " - "which means equal, different, contains, match, " + "The comparision can be = ! . ^ ~ < >, " + "which means equal, different, contains, contains not, match, " "less (as integer), bigger (as integer). " "Match allows a regular expression. " "The second variant checks for a text in a selector, " @@ -2106,13 +2110,13 @@ class If: public Command { } QString command() const { return tag()+" "+_variable+" "+_cmp+" "+_value - +(_script.get()?"\n"+_script->print().join("\n "):""); + +(_script.get()?"\n "+_script->print().join("\n "):""); } std::shared_ptr parse(Script*, QString args, QStringList& in, QString file, int line, int indent) { std::shared_ptr cmd(new If()); - int pos(args.indexOf(QRegularExpression("[=^.~<>]"))); + int pos(args.indexOf(QRegularExpression("[=!.^~<>]"))); int len(1); if (args.contains("->")) { pos = args.indexOf("->"); @@ -2126,7 +2130,7 @@ class If: public Command { cmd->_value = args.mid(pos+len).trimmed(); cmd->_script = std::shared_ptr