Comments (9)
unittests have there own project and it's cmake only.
it's in the tests folder
from sqlitebrowser.
Yeah, trying to figure out how to run it. Making progress...
$ cd tests
$ cmake .
-- The C compiler identification is AppleClang 4.2.0.4250028
-- The CXX compiler identification is AppleClang 4.2.0.4250028
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - found
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - found
-- Found Qt4: /usr/local/bin/qmake (found version "4.8.6")
-- Build type is Release
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jc/git_repos/sqlitebrowser/tests
$ make sqlb-unittests
Scanning dependencies of target antlr
[ 2%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ANTLRUtil.cpp.o
[ 5%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTFactory.cpp.o
[ 8%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTNULLType.cpp.o
[ 11%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTRefCount.cpp.o
[ 14%] Building CXX object antlr/CMakeFiles/antlr.dir/src/BaseAST.cpp.o
[ 17%] Building CXX object antlr/CMakeFiles/antlr.dir/src/BitSet.cpp.o
[ 20%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CharBuffer.cpp.o
[ 22%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CharScanner.cpp.o
[ 25%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonAST.cpp.o
[ 28%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonASTWithHiddenTokens.cpp.o
[ 31%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonHiddenStreamToken.cpp.o
[ 34%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonToken.cpp.o
[ 37%] Building CXX object antlr/CMakeFiles/antlr.dir/src/InputBuffer.cpp.o
[ 40%] Building CXX object antlr/CMakeFiles/antlr.dir/src/LLkParser.cpp.o
[ 42%] Building CXX object antlr/CMakeFiles/antlr.dir/src/MismatchedCharException.cpp.o
[ 45%] Building CXX object antlr/CMakeFiles/antlr.dir/src/MismatchedTokenException.cpp.o
[ 48%] Building CXX object antlr/CMakeFiles/antlr.dir/src/NoViableAltException.cpp.o
[ 51%] Building CXX object antlr/CMakeFiles/antlr.dir/src/NoViableAltForCharException.cpp.o
[ 54%] Building CXX object antlr/CMakeFiles/antlr.dir/src/Parser.cpp.o
[ 57%] Building CXX object antlr/CMakeFiles/antlr.dir/src/RecognitionException.cpp.o
[ 60%] Building CXX object antlr/CMakeFiles/antlr.dir/src/String.cpp.o
/Users/jc/git_repos/sqlitebrowser/libs/antlr-2.7.7/src/String.cpp:41:19: warning: format specifies type 'unsigned int' but the argument has
type 'size_t' (aka 'unsigned long') [-Wformat]
sprintf(tmp,"%u",rhs);
~~ ^~~
%lu
1 warning generated.
[ 62%] Building CXX object antlr/CMakeFiles/antlr.dir/src/Token.cpp.o
[ 65%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenBuffer.cpp.o
[ 68%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenRefCount.cpp.o
[ 71%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamBasicFilter.cpp.o
[ 74%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamHiddenTokenFilter.cpp.o
[ 77%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamRewriteEngine.cpp.o
[ 80%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamSelector.cpp.o
[ 82%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TreeParser.cpp.o
Linking CXX static library libantlr.a
[ 82%] Built target antlr
[ 85%] Generating __/src/tests/moc_testsqlobjects.cxx
Scanning dependencies of target sqlb-unittests
[ 88%] Building CXX object CMakeFiles/sqlb-unittests.dir/__/src/tests/moc_testsqlobjects.cxx.o
[ 91%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/sqlitetypes.cpp.o
[ 94%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/grammar/Sqlite3Lexer.cpp.o
[ 97%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/grammar/Sqlite3Parser.cpp.o
[100%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/tests/testsqlobjects.cpp.o
Linking CXX executable sqlb-unittests
[100%] Built target sqlb-unittests
Is this the correct way to run it?
$ ./sqlb-unittests
********* Start testing of TestTable *********
Config: Using QTest library 4.8.6, Qt 4.8.6
PASS : TestTable::initTestCase()
PASS : TestTable::sqlOutput()
PASS : TestTable::autoincrement()
PASS : TestTable::notnull()
PASS : TestTable::withoutRowid()
PASS : TestTable::parseSQL()
PASS : TestTable::parseSQLdefaultexpr()
PASS : TestTable::parseSQLMultiPk()
PASS : TestTable::parseSQLForeignKey()
PASS : TestTable::parseSQLSingleQuotes()
PASS : TestTable::parseSQLKeywordInIdentifier()
PASS : TestTable::parseSQLWithoutRowid()
PASS : TestTable::parseNonASCIIChars()
PASS : TestTable::createTableWithIn()
PASS : TestTable::createTableWithNotLikeConstraint()
PASS : TestTable::cleanupTestCase()
Totals: 16 passed, 0 failed, 0 skipped
********* Finished testing of TestTable *********
from sqlitebrowser.
yes, except I would always recommend to make a build folder for cmake.
[../sqlitebrowser/tests]$ make build
[../sqlitebrowser/tests]$ cd build
[../sqlitebrowser/tests/build]$ cmake ..
[../sqlitebrowser/tests/build]$ make
[../sqlitebrowser/tests/build]$ ./sqlb-unittests
from sqlitebrowser.
Thanks Rene. 😄
Should we update the BUILDING file to include mkdir build; cd build; cmake .. in it for normal building (for cmake approach). It doesn't have that atm.
from sqlitebrowser.
Not necessarily, It actually is for a bit more advanced stuff, like I have laying around different build folder for win-build, qt4, qt5, debug, release...
Devs with a bit of understanding of cmake will know this and others can ask ;)
from sqlitebrowser.
No worries there. 😄
Hmmm, using the build subdir approach inside the tests dir, it barfs for me during compile:
$ pwd
/Users/jc/git_repos/sqlitebrowser
$ git pull
Already up-to-date.
$ cd tests
$ ls -la
total 16
drwxr-xr-x 4 jc wheel 136 6 Jul 08:28 .
drwxr-xr-x 16 jc wheel 544 6 Jul 08:28 ..
-rw-r--r-- 1 jc wheel 1300 6 Jul 08:28 CMakeLists.txt
-rwxr-xr-x 1 jc wheel 858 6 Jul 08:28 createtestdb.py
$ mkdir build
$ cd build
$ cmake ..
-- The C compiler identification is AppleClang 4.2.0.4250028
-- The CXX compiler identification is AppleClang 4.2.0.4250028
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - found
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - found
-- Found Qt4: /usr/local/bin/qmake (found version "4.8.6")
-- Build type is Release
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jc/git_repos/sqlitebrowser/tests/build
$ make
Scanning dependencies of target antlr
[ 2%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ANTLRUtil.cpp.o
[ 5%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTFactory.cpp.o
[ 8%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTNULLType.cpp.o
[ 11%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTRefCount.cpp.o
[ 14%] Building CXX object antlr/CMakeFiles/antlr.dir/src/BaseAST.cpp.o
[ 17%] Building CXX object antlr/CMakeFiles/antlr.dir/src/BitSet.cpp.o
[ 20%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CharBuffer.cpp.o
[ 22%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CharScanner.cpp.o
[ 25%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonAST.cpp.o
[ 28%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonASTWithHiddenTokens.cpp.o
[ 31%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonHiddenStreamToken.cpp.o
[ 34%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonToken.cpp.o
[ 37%] Building CXX object antlr/CMakeFiles/antlr.dir/src/InputBuffer.cpp.o
[ 40%] Building CXX object antlr/CMakeFiles/antlr.dir/src/LLkParser.cpp.o
[ 42%] Building CXX object antlr/CMakeFiles/antlr.dir/src/MismatchedCharException.cpp.o
[ 45%] Building CXX object antlr/CMakeFiles/antlr.dir/src/MismatchedTokenException.cpp.o
[ 48%] Building CXX object antlr/CMakeFiles/antlr.dir/src/NoViableAltException.cpp.o
[ 51%] Building CXX object antlr/CMakeFiles/antlr.dir/src/NoViableAltForCharException.cpp.o
[ 54%] Building CXX object antlr/CMakeFiles/antlr.dir/src/Parser.cpp.o
[ 57%] Building CXX object antlr/CMakeFiles/antlr.dir/src/RecognitionException.cpp.o
[ 60%] Building CXX object antlr/CMakeFiles/antlr.dir/src/String.cpp.o
/Users/jc/git_repos/sqlitebrowser/libs/antlr-2.7.7/src/String.cpp:41:19: warning: format specifies type 'unsigned int' but the argument has
type 'size_t' (aka 'unsigned long') [-Wformat]
sprintf(tmp,"%u",rhs);
~~ ^~~
%lu
1 warning generated.
[ 62%] Building CXX object antlr/CMakeFiles/antlr.dir/src/Token.cpp.o
[ 65%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenBuffer.cpp.o
[ 68%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenRefCount.cpp.o
[ 71%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamBasicFilter.cpp.o
[ 74%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamHiddenTokenFilter.cpp.o
[ 77%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamRewriteEngine.cpp.o
[ 80%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamSelector.cpp.o
[ 82%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TreeParser.cpp.o
Linking CXX static library libantlr.a
[ 82%] Built target antlr
[ 85%] Generating __/src/tests/moc_testsqlobjects.cxx
Scanning dependencies of target sqlb-unittests
[ 88%] Building CXX object CMakeFiles/sqlb-unittests.dir/__/src/tests/moc_testsqlobjects.cxx.o
[ 91%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/sqlitetypes.cpp.o
In file included from /Users/jc/git_repos/sqlitebrowser/src/sqlitetypes.cpp:1:
/Users/jc/git_repos/sqlitebrowser/src/sqlitetypes.h:5:10: fatal error: 'antlr/ASTRefCount.hpp' file not found
#include "antlr/ASTRefCount.hpp"
^
1 error generated.
make[2]: *** [CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/sqlitetypes.cpp.o] Error 1
make[1]: *** [CMakeFiles/sqlb-unittests.dir/all] Error 2
make: *** [all] Error 2
$
Seems to work when done in a "tests" subdir from the main dir though. Bug?
$ pwd
/Users/jc/git_repos/sqlitebrowser
$ mkdir build
$ cd build
$ cmake ../tests
-- The C compiler identification is AppleClang 4.2.0.4250028
-- The CXX compiler identification is AppleClang 4.2.0.4250028
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - found
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - found
-- Found Qt4: /usr/local/bin/qmake (found version "4.8.6")
-- Build type is Release
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jc/git_repos/sqlitebrowser/build
$ make
Scanning dependencies of target antlr
[ 2%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ANTLRUtil.cpp.o
[ 5%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTFactory.cpp.o
[ 8%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTNULLType.cpp.o
[ 11%] Building CXX object antlr/CMakeFiles/antlr.dir/src/ASTRefCount.cpp.o
[ 14%] Building CXX object antlr/CMakeFiles/antlr.dir/src/BaseAST.cpp.o
[ 17%] Building CXX object antlr/CMakeFiles/antlr.dir/src/BitSet.cpp.o
[ 20%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CharBuffer.cpp.o
[ 22%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CharScanner.cpp.o
[ 25%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonAST.cpp.o
[ 28%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonASTWithHiddenTokens.cpp.o
[ 31%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonHiddenStreamToken.cpp.o
[ 34%] Building CXX object antlr/CMakeFiles/antlr.dir/src/CommonToken.cpp.o
[ 37%] Building CXX object antlr/CMakeFiles/antlr.dir/src/InputBuffer.cpp.o
[ 40%] Building CXX object antlr/CMakeFiles/antlr.dir/src/LLkParser.cpp.o
[ 42%] Building CXX object antlr/CMakeFiles/antlr.dir/src/MismatchedCharException.cpp.o
[ 45%] Building CXX object antlr/CMakeFiles/antlr.dir/src/MismatchedTokenException.cpp.o
[ 48%] Building CXX object antlr/CMakeFiles/antlr.dir/src/NoViableAltException.cpp.o
[ 51%] Building CXX object antlr/CMakeFiles/antlr.dir/src/NoViableAltForCharException.cpp.o
[ 54%] Building CXX object antlr/CMakeFiles/antlr.dir/src/Parser.cpp.o
[ 57%] Building CXX object antlr/CMakeFiles/antlr.dir/src/RecognitionException.cpp.o
[ 60%] Building CXX object antlr/CMakeFiles/antlr.dir/src/String.cpp.o
/Users/jc/git_repos/sqlitebrowser/libs/antlr-2.7.7/src/String.cpp:41:19: warning: format specifies type 'unsigned int' but the argument has type
'size_t' (aka 'unsigned long') [-Wformat]
sprintf(tmp,"%u",rhs);
~~ ^~~
%lu
1 warning generated.
[ 62%] Building CXX object antlr/CMakeFiles/antlr.dir/src/Token.cpp.o
[ 65%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenBuffer.cpp.o
[ 68%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenRefCount.cpp.o
[ 71%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamBasicFilter.cpp.o
[ 74%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamHiddenTokenFilter.cpp.o
[ 77%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamRewriteEngine.cpp.o
[ 80%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TokenStreamSelector.cpp.o
[ 82%] Building CXX object antlr/CMakeFiles/antlr.dir/src/TreeParser.cpp.o
Linking CXX static library libantlr.a
[ 82%] Built target antlr
[ 85%] Generating __/src/tests/moc_testsqlobjects.cxx
Scanning dependencies of target sqlb-unittests
[ 88%] Building CXX object CMakeFiles/sqlb-unittests.dir/__/src/tests/moc_testsqlobjects.cxx.o
[ 91%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/sqlitetypes.cpp.o
[ 94%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/grammar/Sqlite3Lexer.cpp.o
[ 97%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/grammar/Sqlite3Parser.cpp.o
[100%] Building CXX object CMakeFiles/sqlb-unittests.dir/Users/jc/git_repos/sqlitebrowser/src/tests/testsqlobjects.cpp.o
Linking CXX executable sqlb-unittests
[100%] Built target sqlb-unittests
$ ./sqlb-unittests
********* Start testing of TestTable *********
Config: Using QTest library 4.8.6, Qt 4.8.6
PASS : TestTable::initTestCase()
PASS : TestTable::sqlOutput()
PASS : TestTable::autoincrement()
PASS : TestTable::notnull()
PASS : TestTable::withoutRowid()
PASS : TestTable::parseSQL()
PASS : TestTable::parseSQLdefaultexpr()
PASS : TestTable::parseSQLMultiPk()
PASS : TestTable::parseSQLForeignKey()
PASS : TestTable::parseSQLSingleQuotes()
PASS : TestTable::parseSQLKeywordInIdentifier()
PASS : TestTable::parseSQLWithoutRowid()
PASS : TestTable::parseNonASCIIChars()
PASS : TestTable::createTableWithIn()
PASS : TestTable::createTableWithNotLikeConstraint()
PASS : TestTable::cleanupTestCase()
Totals: 16 passed, 0 failed, 0 skipped
********* Finished testing of TestTable *********
from sqlitebrowser.
fixed 968c12a
from sqlitebrowser.
Yep, works now. I'll update the BUILDING doc in a minute with this new unit testing info.
from sqlitebrowser.
How's this look? #44
from sqlitebrowser.
Related Issues (20)
- [Bug]: creation of new db file upon attach of non-existing file fails. HOT 2
- [Feature]: "Filter in any column" should only filter in '__rowid__' is visible HOT 3
- Add Debug Information to 'Continuous' Release HOT 2
- Check Update for Unstable Build HOT 1
- Port to Qt 6 HOT 1
- Rewrite Build Entries in the Wiki HOT 1
- Support for Branch-Specific Build Variants HOT 1
- [Bug]: Importing CSV with column headers doesn't work if columns are not in same order as table in DB HOT 1
- Quick Browse HOT 1
- [Feature]: Comment Line Shortcut key for "Execute SQL" tab and Shortcut Key selection screen HOT 3
- [Feature]: auto reopen last database HOT 7
- No data returned from SQL query HOT 2
- [Bug]: Can't run nightly build on macOS 12.7.4 HOT 7
- [Bug]: External drives cannot be opened on Ubuntu HOT 3
- [Bug]: Execute SQL Console overlaps text HOT 2
- [Feature]: Allow NOT operator '!' in front of filters
- [Bug]: Find and Replace fails to replace all finds HOT 1
- [Bug]: Copy/paste results of SQL select hangs / freeze program
- [Feature]: Plot - change axis to log scale
- [Bug]: When you start the program, an error message appears. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlitebrowser.