Skip to content

Commit 29aaf9b

Browse files
committed
make test
Now that Travis is gone, we need some kind of automated check. Until someone defines, for example, a GitHub action, this commit adds a sanity check that we can build a SQLite library and link with it, with `make test`. Also, add `make distclean` for restoring the repository in a pristine state.
1 parent bdba433 commit 29aaf9b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
test: test_open_connection
2+
3+
# Test that we can use the custom SQLite library and open a connection.
4+
test_open_connection: build/open_connection
5+
build/open_connection
6+
7+
build/open_connection: sqlite3.h
8+
cc test/open_connection.c -Lbuild/Release -lsqlitecustom -I. -o build/open_connection
9+
10+
sqlite3.h: SQLiteLib-USER.xcconfig
11+
xcodebuild -project SQLiteLib.xcodeproj -target sqlitecustom -sdk macosx
12+
13+
SQLiteLib-USER.xcconfig: SQLiteLib-USER.xcconfig.example
14+
cp -n SQLiteLib-USER.xcconfig.example SQLiteLib-USER.xcconfig
15+
16+
distclean:
17+
git clean -dfx .
18+
19+
.PHONY: test test_open_connection distclean

test/open_connection.c

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <sqlite3.h>
2+
#include <stdio.h>
3+
4+
int main(int argc, char *argv[]) {
5+
sqlite3 *connection;
6+
int code = sqlite3_open(":memory:", &connection);
7+
sqlite3_close(connection);
8+
return (code != SQLITE_OK);
9+
}

0 commit comments

Comments
 (0)