summaryrefslogtreecommitdiff
path: root/test/public-api.cpp
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-06-23 23:10:20 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-06-25 16:11:11 +0100
commitfc9b226d19b59e965b1746ba5dc6fc603de3b591 (patch)
tree6a50ea9111f00f56d4bf08431cfd3e7db1c876fc /test/public-api.cpp
parent5c01d541208d32265d398e07085bcdf4606cc1f5 (diff)
test: Ensure LIBCAMERA_BASE_PRIVATE isn't public
If LIBCAMERA_BASE_PRIVATE is ever exposed on the libcamera public dependencies, then the private.h header protection will be circumvented. Provide a test which will fail (at compile time) if the LIBCAMERA_BASE_PRIVATE define ever leaks to the public dependencies. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'test/public-api.cpp')
-rw-r--r--test/public-api.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/public-api.cpp b/test/public-api.cpp
new file mode 100644
index 00000000..a1cebcf9
--- /dev/null
+++ b/test/public-api.cpp
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2021, Google Inc.
+ *
+ * public-api.cpp - Public API validation
+ */
+
+#include <libcamera/libcamera.h>
+
+#include "test.h"
+
+class PublicAPITest : public Test
+{
+ int run()
+ {
+#ifdef LIBCAMERA_BASE_PRIVATE
+#error "Public interfaces should not be exposed to LIBCAMERA_BASE_PRIVATE"
+ return TestFail;
+#else
+ return TestPass;
+#endif
+ }
+};
+
+TEST_REGISTER(PublicAPITest)