[igt-dev] [PATCH i-g-t 15/29] lib/igt_aux: add null implementation

D Scott Phillips d.scott.phillips at intel.com
Wed Dec 11 00:52:21 UTC 2019


igt_aux depends on Linux specific functionality like udev, sysfs,
and others. Add a do-nothing implementation of the same API for
inclusion on other platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips at intel.com>
---
 lib/igt_aux_null.c | 139 +++++++++++++++++++++++++++++++++++++++++++++
 lib/meson.build    |  11 +++-
 2 files changed, 149 insertions(+), 1 deletion(-)
 create mode 100644 lib/igt_aux_null.c

diff --git a/lib/igt_aux_null.c b/lib/igt_aux_null.c
new file mode 100644
index 00000000..b83217e4
--- /dev/null
+++ b/lib/igt_aux_null.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "igt_aux.h"
+
+void igt_fork_signal_helper(void) {
+}
+
+void igt_stop_signal_helper(void) {
+}
+
+void igt_suspend_signal_helper(void) {
+}
+
+void igt_resume_signal_helper(void) {
+}
+
+void igt_fork_shrink_helper(int fd) {
+}
+
+void igt_stop_shrink_helper(void) {
+}
+
+void igt_fork_hang_detector(int fd) {
+}
+
+void igt_stop_hang_detector(void) {
+}
+
+bool __igt_sigiter_continue(struct __igt_sigiter *iter, bool interrupt) {
+	return false;
+}
+
+void igt_exchange_int(void *array, unsigned i, unsigned j) {
+	igt_swap(((int *)array)[i], ((int *)array)[j]);
+}
+
+void igt_exchange_int64(void *array, unsigned i, unsigned j) {
+	igt_swap(((int64_t *)array)[i], ((int64_t *)array)[j]);
+}
+
+void igt_permute_array(void *array, unsigned size,
+			   void (*exchange_func)(void *array,
+						 unsigned i,
+						 unsigned j)) {
+}
+
+void igt_progress(const char *header, uint64_t i, uint64_t total) {
+}
+
+void igt_print_activity(void) {
+}
+
+bool igt_check_boolean_env_var(const char *env_var, bool default_value) {
+	return false;
+}
+
+bool igt_aub_dump_enabled(void) {
+	return false;
+}
+
+void igt_system_suspend_autoresume(enum igt_suspend_state state,
+				   enum igt_suspend_test test) {
+}
+
+void igt_set_autoresume_delay(int delay_secs) {
+}
+
+int igt_get_autoresume_delay(enum igt_suspend_state state) {
+	return 1;
+}
+
+void igt_drop_root(void) {
+}
+
+void igt_debug_wait_for_keypress(const char *var) {
+}
+
+void igt_debug_manual_check(const char *var, const char *expected) {
+}
+
+void igt_lock_mem(size_t size) {
+}
+
+void igt_unlock_mem(void) {
+}
+
+void igt_start_siglatency(int sig) {
+}
+
+double igt_stop_siglatency(struct igt_mean *result) {
+	return 1.0;
+}
+
+bool igt_allow_unlimited_files(void) {
+	return true;
+}
+
+void igt_set_module_param(const char *name, const char *val) {
+}
+
+void igt_set_module_param_int(const char *name, int val) {
+}
+
+int igt_is_process_running(const char *comm) {
+	return 0;
+}
+
+int igt_terminate_process(int sig, const char *comm) {
+	return 0;
+}
+
+void igt_lsof(const char *dpath) {
+}
+
+uint64_t vfs_file_max(void) {
+	return 1;
+}
diff --git a/lib/meson.build b/lib/meson.build
index 25ea62d5..6a56fff0 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -11,7 +11,6 @@ lib_sources = [
 	'igt_debugfs.c',
 	'igt_device.c',
 	'igt_device_scan.c',
-	'igt_aux.c',
 	'igt_gt.c',
 	'igt_halffloat.c',
 	'igt_matrix.c',
@@ -67,6 +66,16 @@ lib_sources = [
 	'veboxcopy_gen12.c',
 ]
 
+if host_machine.system() == 'linux'
+	lib_sources += [
+		'igt_aux.c',
+	]
+else
+	lib_sources += [
+		'igt_aux_null.c',
+	]
+endif
+
 lib_deps = [
 	cairo,
 	glib,
-- 
2.23.0



More information about the igt-dev mailing list