Skip to contentSkip to conversation

support/testing: sqlitecpp: new runtime test

PATCH Applied Michael Nosthoff via buildroot 1 participant 12 messages Oct 2 – Oct 16

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 support/testing: sqlitecpp: new runtime test

build and run an SQLiteCpp example to check database writes and queries.

Assisted-by GitHub Copilot:GPT-6 Sol

---

V2: use correct path(s) in DEVELOPERS

---
 DEVELOPERS                                    |  2 ++
 .../package/br2-external/sqlitecpp/Config.in  |  1 +
 .../br2-external/sqlitecpp/external.desc      |  1 +
 .../br2-external/sqlitecpp/external.mk        |  1 +
 .../package/sqlitecpp-test/Config.in          |  5 ++++
 .../package/sqlitecpp-test/sqlitecpp-test.cpp | 27 +++++++++++++++++++
 .../package/sqlitecpp-test/sqlitecpp-test.mk  | 19 +++++++++++++
 .../testing/tests/package/test_sqlitecpp.py   | 25 +++++++++++++++++
 8 files changed, 81 insertions(+)
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/Config.in
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/external.desc
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/external.mk
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/Config.in
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/sqlitecpp-test.cpp
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/sqlitecpp-test.mk
 create mode 100644 support/testing/tests/package/test_sqlitecpp.py
DEVELOPERS +2 -0
index d62bfaafb3..db5fe9b5e0 100644
@@ -2464,6 +2464,8 @@ F:	package/protobuf/
 F:	package/sdbus-cpp/
 F:	package/spdlog/
 F:	package/sqlitecpp/
+F:	support/testing/tests/package/br2-external/sqlitecpp/
+F:	support/testing/tests/package/test_sqlitecpp.py
 
 N:	Michael Trimarchi <[email protected]>
 F:	board/bsh/
support/testing/tests/package/br2-external/sqlitecpp/Config.in new file +1 -0
new file mode 100644
index 0000000000..586f1dfa5a
@@ -0,0 +1 @@
+source "$BR2_EXTERNAL_SQLITECPP_PATH/package/sqlitecpp-test/Config.in"
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/external.desc new file +1 -0
new file mode 100644
index 0000000000..003e033127
@@ -0,0 +1 @@
+name: SQLITECPP
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/external.mk new file +1 -0
new file mode 100644
index 0000000000..b5db18b281
@@ -0,0 +1 @@
+include $(sort $(wildcard $(BR2_EXTERNAL_SQLITECPP_PATH)/package/*/*.mk))
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/Config.in new file +5 -0
new file mode 100644
index 0000000000..d83b99bad8
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_SQLITECPP_TEST
+	bool "sqlitecpp-test"
+	depends on BR2_PACKAGE_SQLITECPP
+	help
+	  Test program for the SQLiteCpp library.
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/sqlitecpp-test.cpp new file +27 -0
new file mode 100644
index 0000000000..d888a9a392
@@ -0,0 +1,27 @@
+#include <SQLiteCpp/SQLiteCpp.h>
+
+#include <iostream>
+#include <string>
+
+int main()
+{
+    SQLite::Database db(":memory:", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
+    db.exec("CREATE TABLE fruits (name TEXT, color TEXT)");
+
+    SQLite::Statement insert(db, "INSERT INTO fruits VALUES (?, ?)");
+    insert.bind(1, "Banana");
+    insert.bind(2, "Yellow");
+    insert.exec();
+
+    SQLite::Statement query(db, "SELECT name, color FROM fruits");
+    if (!query.executeStep()) {
+        return 1;
+    }
+    const std::string name = query.getColumn(0).getString();
+    const std::string color = query.getColumn(1).getString();
+    if (name != "Banana" || color != "Yellow" || query.executeStep()) {
+        return 1;
+    }
+    std::cout << name << ": " << color << std::endl;
+    return 0;
+}
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/sqlitecpp-test.mk new file +19 -0
new file mode 100644
index 0000000000..da557ad874
@@ -0,0 +1,19 @@
+################################################################################
+#
+# sqlitecpp-test
+#
+################################################################################
+
+SQLITECPP_TEST_DEPENDENCIES = sqlitecpp
+
+define SQLITECPP_TEST_BUILD_CMDS
+	$(TARGET_CXX) $(TARGET_CXXFLAGS) -o $(@D)/sqlitecpp-test \
+		$(SQLITECPP_TEST_PKGDIR)/sqlitecpp-test.cpp \
+		$(TARGET_LDFLAGS) -lSQLiteCpp -lsqlite3
+endef
+
+define SQLITECPP_TEST_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/sqlitecpp-test $(TARGET_DIR)/usr/bin/sqlitecpp-test
+endef
+
+$(eval $(generic-package))
\ No newline at end of file
support/testing/tests/package/test_sqlitecpp.py new file +25 -0
new file mode 100644
index 0000000000..59844d4628
@@ -0,0 +1,25 @@
+import os
+
+import infra.basetest
+
+
+class TestSQLiteCpp(infra.basetest.BRTest):
+    br2_external = [infra.filepath("tests/package/br2-external/sqlitecpp")]
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_SQLITECPP=y
+        BR2_PACKAGE_SQLITECPP_TEST=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        output, exit_code = self.emulator.run("/usr/bin/sqlitecpp-test")
+        self.assertEqual(exit_code, 0, output)
+        self.assertIn("Banana: Yellow", output)
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 2/4 package/sqlitecpp: disable stack_protection

SQLiteCpp has an internal setting for stack protection which defaults to "on".
Since Buildroot passes this options itself this is not needed.

Fixes:
br-test-pkg/bootlin-x86-i686-musl
https://gitlab.com/heinemml/buildroot/-/jobs/16865965418

---
 package/sqlitecpp/sqlitecpp.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/sqlitecpp/sqlitecpp.mk +2 -1
index 95ddc953cb..418860fc6d 100644
@@ -14,6 +14,7 @@ SQLITECPP_INSTALL_STAGING = YES
 SQLITECPP_CONF_OPTS = \
 	-DSQLITECPP_INTERNAL_SQLITE=OFF \
 	-DSQLITECPP_RUN_CPPLINT=OFF \
-	-DSQLITECPP_RUN_CPPCHECK=OFF
+	-DSQLITECPP_RUN_CPPCHECK=OFF \
+	-DSQLITECPP_USE_STACK_PROTECTION=OFF
 
 $(eval $(cmake-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v2 2/4] package/sqlitecpp: disable stack_protection

Quoted 9 lines · Michael Nosthoff via buildroot

SQLiteCpp has an internal setting for stack protection which defaults to "on".
Since Buildroot passes this options itself this is not needed.

Fixes:
br-test-pkg/bootlin-x86-i686-musl
https://gitlab.com/heinemml/buildroot/-/jobs/16865965418

Thanks for the patch. Since this is a fix, we need to know which commit introduced the issue, so that we can figure out whether it needs to be backported to our LTS branches or not. Which version bump of sqlitecpp unconditionally enabled stack protection support causing this issue?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v2 2/4] package/sqlitecpp: disable stack_protection

Hi Thomas,

Quoted 9 lines · Thomas Petazzoni
Quoted 8 lines · Michael Nosthoff via buildroot

SQLiteCpp has an internal setting for stack protection which defaults to "on".
Since Buildroot passes this options itself this is not needed.

Fixes:
br-test-pkg/bootlin-x86-i686-musl
https://gitlab.com/heinemml/buildroot/-/jobs/16865965418

Quoted 8 lines
Quoted 1 line

Thanks for the patch. Since this is a fix, we need to know which commit introduced the issue, so that we can figure out whether it needs to be backported to our LTS branches or not. Which version bump of sqlitecpp unconditionally enabled stack protection support causing this issue?

The package was initially added in e74059b39ce2f which contained version 3.3.1. This already contained this option [0]. So the issue has always been there and the fix should be backported to all maintenance branches.

Regards,
Michael

[0] https://github.com/SRombauts/SQLiteCpp/blob/3.3.1/CMakeLists.txt#L80

Quoted 7 lines

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH v2 2/4] package/sqlitecpp: disable stack_protection

Quoted 10 lines · Michael Nosthoff
Quoted 6 lines

Thanks for the patch. Since this is a fix, we need to know which commit introduced the issue, so that we can figure out whether it needs to be backported to our LTS branches or not. Which version bump of sqlitecpp unconditionally enabled stack protection support causing this issue?

The package was initially added in e74059b39ce2f which contained version 3.3.1. This already contained this option [0]. So the issue has always been there and the fix should be backported to all maintenance branches.

Thanks for the information. I used it to improve the commit message. For future patches that are fixes, we recommend to always include in the commit log some details indicating what introduced the bug/regression.

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Re: [Buildroot] [PATCH v2 2/4] package/sqlitecpp: disable stack_protection

In reply to Michael Nosthoff via buildroot

In reply of:

Quoted 9 lines

SQLiteCpp has an internal setting for stack protection which defaults to "on".
Since Buildroot passes this options itself this is not needed.

Fixes:
br-test-pkg/bootlin-x86-i686-musl
https://gitlab.com/heinemml/buildroot/-/jobs/16865965418

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 9 lines
---
 package/sqlitecpp/sqlitecpp.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/sqlitecpp/sqlitecpp.mk +0 -0
index 95ddc953cb..418860fc6d 100644

package/sqlitecpp/sqlitecpp.mk SQLITECPP_INSTALL_STAGING = YES · line 20

Quoted 8 lines
package/sqlitecpp/sqlitecpp.mk +2 -1
@@ -14,6 +14,7 @@ SQLITECPP_INSTALL_STAGING = YES
 SQLITECPP_CONF_OPTS = \
 	-DSQLITECPP_INTERNAL_SQLITE=OFF \
 	-DSQLITECPP_RUN_CPPLINT=OFF \
-	-DSQLITECPP_RUN_CPPCHECK=OFF
+	-DSQLITECPP_RUN_CPPCHECK=OFF \
+	-DSQLITECPP_USE_STACK_PROTECTION=OFF
 
 $(eval $(cmake-package))

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw

PATCH v2 3/4 package/sqlitecpp: needs threads

In reply to Michael Nosthoff via buildroot

SQLiteCpp has an unconditional dependency on threads.

fixes:
br-test-pkg/br-arm-full-nothread
https://gitlab.com/heinemml/buildroot/-/jobs/16865965420

---
 package/sqlitecpp/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/sqlitecpp/Config.in +4 -2
index 31de9a3904..614c46cb54 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_SQLITECPP
 	bool "sqlitecpp"
 	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
 	select BR2_PACKAGE_SQLITE
 	select BR2_PACKAGE_SQLITE_ENABLE_COLUMN_METADATA
@@ -10,5 +11,6 @@ config BR2_PACKAGE_SQLITECPP
 
 	  https://github.com/SRombauts/SQLiteCpp
 
-comment "sqlitecpp needs a toolchain w/ C++11, gcc >= 4.9"
-	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
+comment "sqlitecpp needs a toolchain w/ C++11, threads, gcc >= 4.9"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Re: [Buildroot] [PATCH v2 3/4] package/sqlitecpp: needs threads

Quoted 7 lines · Michael Nosthoff via buildroot

SQLiteCpp has an unconditional dependency on threads.

fixes:
br-test-pkg/br-arm-full-nothread
https://gitlab.com/heinemml/buildroot/-/jobs/16865965420

Thanks for the patch. Since this is a fix, we need to know which commit introduced the issue, so that we can figure out whether it needs to be backported to our LTS branches or not. Which version bump of sqlitecpp started requiring thread support?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Re: [Buildroot] [PATCH v2 3/4] package/sqlitecpp: needs threads

In reply to Michael Nosthoff via buildroot

In reply of:

Quoted 7 lines

SQLiteCpp has an unconditional dependency on threads.

fixes:
br-test-pkg/br-arm-full-nothread
https://gitlab.com/heinemml/buildroot/-/jobs/16865965420

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 17 lines
---
 package/sqlitecpp/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/sqlitecpp/Config.in +1 -0
index 31de9a3904..614c46cb54 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_SQLITECPP
 	bool "sqlitecpp"
 	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
 	select BR2_PACKAGE_SQLITE
 	select BR2_PACKAGE_SQLITE_ENABLE_COLUMN_METADATA

package/sqlitecpp/Config.in config BR2_PACKAGE_SQLITECPP · line 16

Quoted 8 lines
package/sqlitecpp/Config.in +3 -2
@@ -10,5 +11,6 @@ config BR2_PACKAGE_SQLITECPP
 
 	  https://github.com/SRombauts/SQLiteCpp
 
-comment "sqlitecpp needs a toolchain w/ C++11, gcc >= 4.9"
-	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
+comment "sqlitecpp needs a toolchain w/ C++11, threads, gcc >= 4.9"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw

PATCH v2 4/4 package/sqlitecpp: bump to version 3.4.0

In reply to Michael Nosthoff via buildroot

- licenses hash changed due to updated year

changelog:
https://github.com/SRombauts/SQLiteCpp/releases/tag/3.4.0

---

Pipeline with br-test-pkg and runtime test:
https://gitlab.com/heinemml/buildroot/-/pipelines/2901349165

---
 package/sqlitecpp/sqlitecpp.hash | 4 ++--
 package/sqlitecpp/sqlitecpp.mk   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
package/sqlitecpp/sqlitecpp.hash +2 -2
index 960d9bfb21..c9de5048e5 100644
@@ -1,3 +1,3 @@
 # Locally computed:
-sha256  33bd4372d83bc43117928ee842be64d05e7807f511b5195f85d30015cad9cac6  sqlitecpp-3.3.3.tar.gz
-sha256  a16149966042207bfc968dd1081403d43a37a6264fe31c7b1a7960dbb0e716b9  LICENSE.txt
+sha256  9910ad8bc0a821856bd6d9fa7cb0b457883108f2b803700256b451077ed6dc05  sqlitecpp-3.4.0.tar.gz
+sha256  00f43691f376cc7abdab1f9d72ba9d1a92846b481d2df5ffa1c345108b28048c  LICENSE.txt
package/sqlitecpp/sqlitecpp.mk +1 -1
index 418860fc6d..9c136ed69e 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-SQLITECPP_VERSION = 3.3.3
+SQLITECPP_VERSION = 3.4.0
 SQLITECPP_SITE = $(call github,SRombauts,SQLiteCpp,$(SQLITECPP_VERSION))
 SQLITECPP_LICENSE = MIT
 SQLITECPP_LICENSE_FILES = LICENSE.txt
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw
In reply to Michael Nosthoff via buildroot
Quoted 5 lines · Michael Nosthoff via buildroot

build and run an SQLiteCpp example to check database writes and queries.

Assisted-by GitHub Copilot:GPT-6 Sol

Thanks, entire series applied. I had to amend the commit logs for PATCH 2/4 and 3/4 because it was missing the details on which commit introduced the issue. I also pushed a minor fix commit to adjust the Config.in comment that was incorrectly referring to C++11.

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#11 lore raw
In reply to Michael Nosthoff via buildroot

In reply of:

Quoted 4 lines

build and run an SQLiteCpp example to check database writes and queries.

Assisted-by GitHub Copilot:GPT-6 Sol

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 152 lines

---

V2: use correct path(s) in DEVELOPERS

---
 DEVELOPERS                                    |  2 ++
 .../package/br2-external/sqlitecpp/Config.in  |  1 +
 .../br2-external/sqlitecpp/external.desc      |  1 +
 .../br2-external/sqlitecpp/external.mk        |  1 +
 .../package/sqlitecpp-test/Config.in          |  5 ++++
 .../package/sqlitecpp-test/sqlitecpp-test.cpp | 27 +++++++++++++++++++
 .../package/sqlitecpp-test/sqlitecpp-test.mk  | 19 +++++++++++++
 .../testing/tests/package/test_sqlitecpp.py   | 25 +++++++++++++++++
 8 files changed, 81 insertions(+)
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/Config.in
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/external.desc
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/external.mk
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/Config.in
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/sqlitecpp-test.cpp
 create mode 100644 support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/sqlitecpp-test.mk
 create mode 100644 support/testing/tests/package/test_sqlitecpp.py
DEVELOPERS +2 -0
index d62bfaafb3..db5fe9b5e0 100644
@@ -2464,6 +2464,8 @@ F:	package/protobuf/
 F:	package/sdbus-cpp/
 F:	package/spdlog/
 F:	package/sqlitecpp/
+F:	support/testing/tests/package/br2-external/sqlitecpp/
+F:	support/testing/tests/package/test_sqlitecpp.py
 
 N:	Michael Trimarchi <[email protected]>
 F:	board/bsh/
support/testing/tests/package/br2-external/sqlitecpp/Config.in new file +1 -0
new file mode 100644
index 0000000000..586f1dfa5a
@@ -0,0 +1 @@
+source "$BR2_EXTERNAL_SQLITECPP_PATH/package/sqlitecpp-test/Config.in"
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/external.desc new file +1 -0
new file mode 100644
index 0000000000..003e033127
@@ -0,0 +1 @@
+name: SQLITECPP
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/external.mk new file +1 -0
new file mode 100644
index 0000000000..b5db18b281
@@ -0,0 +1 @@
+include $(sort $(wildcard $(BR2_EXTERNAL_SQLITECPP_PATH)/package/*/*.mk))
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/Config.in new file +5 -0
new file mode 100644
index 0000000000..d83b99bad8
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_SQLITECPP_TEST
+	bool "sqlitecpp-test"
+	depends on BR2_PACKAGE_SQLITECPP
+	help
+	  Test program for the SQLiteCpp library.
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/sqlitecpp-test.cpp new file +27 -0
new file mode 100644
index 0000000000..d888a9a392
@@ -0,0 +1,27 @@
+#include <SQLiteCpp/SQLiteCpp.h>
+
+#include <iostream>
+#include <string>
+
+int main()
+{
+    SQLite::Database db(":memory:", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
+    db.exec("CREATE TABLE fruits (name TEXT, color TEXT)");
+
+    SQLite::Statement insert(db, "INSERT INTO fruits VALUES (?, ?)");
+    insert.bind(1, "Banana");
+    insert.bind(2, "Yellow");
+    insert.exec();
+
+    SQLite::Statement query(db, "SELECT name, color FROM fruits");
+    if (!query.executeStep()) {
+        return 1;
+    }
+    const std::string name = query.getColumn(0).getString();
+    const std::string color = query.getColumn(1).getString();
+    if (name != "Banana" || color != "Yellow" || query.executeStep()) {
+        return 1;
+    }
+    std::cout << name << ": " << color << std::endl;
+    return 0;
+}
\ No newline at end of file
support/testing/tests/package/br2-external/sqlitecpp/package/sqlitecpp-test/sqlitecpp-test.mk new file +19 -0
new file mode 100644
index 0000000000..da557ad874
@@ -0,0 +1,19 @@
+################################################################################
+#
+# sqlitecpp-test
+#
+################################################################################
+
+SQLITECPP_TEST_DEPENDENCIES = sqlitecpp
+
+define SQLITECPP_TEST_BUILD_CMDS
+	$(TARGET_CXX) $(TARGET_CXXFLAGS) -o $(@D)/sqlitecpp-test \
+		$(SQLITECPP_TEST_PKGDIR)/sqlitecpp-test.cpp \
+		$(TARGET_LDFLAGS) -lSQLiteCpp -lsqlite3
+endef
+
+define SQLITECPP_TEST_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/sqlitecpp-test $(TARGET_DIR)/usr/bin/sqlitecpp-test
+endef
+
+$(eval $(generic-package))
\ No newline at end of file
support/testing/tests/package/test_sqlitecpp.py new file +15 -0
new file mode 100644
index 0000000000..59844d4628
@@ -0,0 +1,25 @@
+import os
+
+import infra.basetest
+
+
+class TestSQLiteCpp(infra.basetest.BRTest):
+    br2_external = [infra.filepath("tests/package/br2-external/sqlitecpp")]
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_SQLITECPP=y
+        BR2_PACKAGE_SQLITECPP_TEST=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+

support/testing/tests/package/test_sqlitecpp.py line 25

Quoted 10 lines
support/testing/tests/package/test_sqlitecpp.py new file +10 -0
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        output, exit_code = self.emulator.run("/usr/bin/sqlitecpp-test")
+        self.assertEqual(exit_code, 0, output)
+        self.assertIn("Banana: Yellow", output)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot