Skip to content

Commit

Permalink
Add a README to run the tests as a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Aug 24, 2016
1 parent b3ed484 commit b7ef85c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions tests/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

To test the moc binary, just replace the normal moc by the drop in remplacement
and run qmake as usual, then make check.


To test the plugin, we need to make sure qmake does not want to run moc.
Replace the occurences of Q_OBJECT so qmake ignores it.
The CONFIG+=no_moc is there only for templates2/templates2.pro so it does not run moc either.

git ls-files | xargs sed -i "s|Q_OBJECT|/* qmake ignore Q_OBJECT */\n Q_OBJECT|"
git ls-files | xargs sed -i "s|Q_GADGET|/* qmake ignore Q_GADGET */\n Q_GADGET|"
git ls-files | xargs sed -i "s|Q_NAMESPACE|/* qmake ignore Q_NAMESPACE */\n Q_NAMESPACE|"
git ls-files | xargs sed -i '/^#include "moc_/d'
git ls-files | xargs sed -i '/^#include ".*\.moc"$/d'

qmake ../tests QMAKE_CXX=clang++ "QMAKE_CXXFLAGS=-std=c++1z -Xclang -load -Xclang path/to/libmocng_plugin.so -Xclang -add-plugin -Xclang moc" CONFIG+=no_moc

make check

4 changes: 2 additions & 2 deletions tests/templates2/templates2.pro
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defineReplace(mocngCmdBase) {
}


for (s, TEMPLATEEHEADERS) {
!no_moc:for (s, TEMPLATEEHEADERS) {
sf = $$absolute_path($$s, $$_PRO_FILE_PWD_)
QMAKE_INTERNAL_INCLUDED_FILES += $$sf
sfl = $$cat($$sf, lines)
Expand All @@ -50,4 +50,4 @@ for (s, TEMPLATEEHEADERS) {
}


SOURCES += templatedobj.cpp tst_templates2.cpp
SOURCES += templatedobj.cpp tst_templates2.cpp

0 comments on commit b7ef85c

Please sign in to comment.