diff --git a/erlang/erl-guestfs-proto.c b/erlang/erl-guestfs-proto.c index 3d58e7d84..99382137d 100644 --- a/erlang/erl-guestfs-proto.c +++ b/erlang/erl-guestfs-proto.c @@ -36,6 +36,7 @@ instead of erl_interface. #include "full-write.h" #include "guestfs.h" +#include "guestfs-internal-frontend.h" guestfs_h *g; diff --git a/fish/progress.c b/fish/progress.c index b955480bd..363419e07 100644 --- a/fish/progress.c +++ b/fish/progress.c @@ -26,6 +26,9 @@ #include #include +#include "guestfs.h" +#include "guestfs-internal-frontend.h" + #include "progress.h" /* Include these last since they redefine symbols such as 'lines' @@ -39,8 +42,6 @@ */ extern const char *UP; -#define STREQ(a,b) (strcmp((a),(b)) == 0) - /* Compute the running mean and standard deviation from the * series of estimated values. * diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml index 9cc047c2a..701b766c1 100644 --- a/generator/tests_c_api.ml +++ b/generator/tests_c_api.ml @@ -43,16 +43,7 @@ let rec generate_tests () = #include #include \"guestfs.h\" - -#define STREQ(a,b) (strcmp((a),(b)) == 0) -//#define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0) -#define STRNEQ(a,b) (strcmp((a),(b)) != 0) -//#define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0) -//#define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0) -//#define STRCASEEQLEN(a,b,n) (strncasecmp((a),(b),(n)) == 0) -#define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0) -//#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0) -//#define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0) +#include \"guestfs-internal-frontend.h\" static guestfs_h *g; diff --git a/src/guestfs-internal-frontend.h b/src/guestfs-internal-frontend.h index c80bb3bcd..15ffde191 100644 --- a/src/guestfs-internal-frontend.h +++ b/src/guestfs-internal-frontend.h @@ -17,7 +17,7 @@ */ /* NB: This contains ONLY definitions which are shared by libguestfs - * library, bindings and tools (NOT the daemon). + * library, bindings, tools and tests (NOT the daemon). * * If a definition is only needed by a single component of libguestfs, * then it should NOT be here! diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c index afda85f44..140a90586 100644 --- a/test-tool/test-tool.c +++ b/test-tool/test-tool.c @@ -34,19 +34,7 @@ #include #include - -#define _(str) dgettext(PACKAGE, (str)) -//#define N_(str) dgettext(PACKAGE, (str)) - -#define STREQ(a,b) (strcmp((a),(b)) == 0) -//#define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0) -//#define STRNEQ(a,b) (strcmp((a),(b)) != 0) -//#define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0) -//#define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0) -//#define STRCASEEQLEN(a,b,n) (strncasecmp((a),(b),(n)) == 0) -//#define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0) -//#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0) -#define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0) +#include "guestfs-internal-frontend.h" #ifndef P_tmpdir #define P_tmpdir "/tmp" diff --git a/tests/c-api/test-add-drive-opts.c b/tests/c-api/test-add-drive-opts.c index 897c6fac9..7f6bd4a89 100644 --- a/tests/c-api/test-add-drive-opts.c +++ b/tests/c-api/test-add-drive-opts.c @@ -24,6 +24,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" int main (int argc, char *argv[]) diff --git a/tests/c-api/test-add-libvirt-dom.c b/tests/c-api/test-add-libvirt-dom.c index 6f994056c..2b85a4ef8 100644 --- a/tests/c-api/test-add-libvirt-dom.c +++ b/tests/c-api/test-add-libvirt-dom.c @@ -29,6 +29,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" static void make_test_xml (FILE *fp, const char *cwd) diff --git a/tests/c-api/test-config.c b/tests/c-api/test-config.c index c5411232b..feaeadc3b 100644 --- a/tests/c-api/test-config.c +++ b/tests/c-api/test-config.c @@ -24,6 +24,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" int main (int argc, char *argv[]) diff --git a/tests/c-api/test-create-handle.c b/tests/c-api/test-create-handle.c index edea19f6d..d2bfbbf62 100644 --- a/tests/c-api/test-create-handle.c +++ b/tests/c-api/test-create-handle.c @@ -24,6 +24,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" int main (int argc, char *argv[]) diff --git a/tests/c-api/test-debug-to-file.c b/tests/c-api/test-debug-to-file.c index 5eb561048..4fab5a1da 100644 --- a/tests/c-api/test-debug-to-file.c +++ b/tests/c-api/test-debug-to-file.c @@ -27,9 +27,10 @@ #include #include -#include "ignore-value.h" - #include "guestfs.h" +#include "guestfs-internal-frontend.h" + +#include "ignore-value.h" static void debug_to_file (guestfs_h *g, diff --git a/tests/c-api/test-environment.c b/tests/c-api/test-environment.c index 3c3ed8a40..d5a03d4fb 100644 --- a/tests/c-api/test-environment.c +++ b/tests/c-api/test-environment.c @@ -31,6 +31,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" int main (int argc, char *argv[]) diff --git a/tests/c-api/test-last-errno.c b/tests/c-api/test-last-errno.c index 1773349ad..4d9c7baf2 100644 --- a/tests/c-api/test-last-errno.c +++ b/tests/c-api/test-last-errno.c @@ -30,6 +30,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" int main (int argc, char *argv[]) diff --git a/tests/c-api/test-private-data.c b/tests/c-api/test-private-data.c index f2ff647bf..349d95927 100644 --- a/tests/c-api/test-private-data.c +++ b/tests/c-api/test-private-data.c @@ -27,6 +27,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" #define PREFIX "test_" diff --git a/tests/c-api/test-user-cancel.c b/tests/c-api/test-user-cancel.c index 164997a49..9a8219fc2 100644 --- a/tests/c-api/test-user-cancel.c +++ b/tests/c-api/test-user-cancel.c @@ -45,6 +45,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" static const char *filename = "test.img"; static const off_t filesize = 1024*1024*1024; diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c index d67787fec..4fea0043f 100644 --- a/tests/charsets/test-charset-fidelity.c +++ b/tests/charsets/test-charset-fidelity.c @@ -31,10 +31,7 @@ #include #include "guestfs.h" - -#define STREQ(a,b) (strcmp((a),(b)) == 0) -#define STRNEQ(a,b) (strcmp((a),(b)) != 0) -#define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0) +#include "guestfs-internal-frontend.h" struct filesystem { const char *fs_name; /* Name of filesystem. */ diff --git a/tests/mount-local/test-parallel-mount-local.c b/tests/mount-local/test-parallel-mount-local.c index 989a9bafe..abfbb82f6 100644 --- a/tests/mount-local/test-parallel-mount-local.c +++ b/tests/mount-local/test-parallel-mount-local.c @@ -38,6 +38,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" #include "ignore-value.h" @@ -47,8 +48,6 @@ #define MAX_THREADS 12 #define MBYTES_PER_THREAD 900 -#define STREQ(a,b) (strcmp((a),(b)) == 0) - struct thread_state { pthread_t thread; /* Thread handle. */ char *filename; /* Disk image. */ diff --git a/tests/parallel/test-parallel.c b/tests/parallel/test-parallel.c index 03da540ec..dac1b318e 100644 --- a/tests/parallel/test-parallel.c +++ b/tests/parallel/test-parallel.c @@ -34,14 +34,13 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" #include "ignore-value.h" #define TOTAL_TIME 600 /* Seconds, excluding launch. */ #define NR_THREADS 5 -#define STREQ(a,b) (strcmp((a),(b)) == 0) - struct thread_state { pthread_t thread; /* Thread handle. */ int exit_status; /* Thread exit status. */ diff --git a/tests/regressions/rhbz501893.c b/tests/regressions/rhbz501893.c index 0194c89e0..fdd49c8bf 100644 --- a/tests/regressions/rhbz501893.c +++ b/tests/regressions/rhbz501893.c @@ -24,6 +24,7 @@ #include #include "guestfs.h" +#include "guestfs-internal-frontend.h" int main (int argc, char *argv[]) diff --git a/tests/regressions/rhbz790721.c b/tests/regressions/rhbz790721.c index 72746779e..a1661ce67 100644 --- a/tests/regressions/rhbz790721.c +++ b/tests/regressions/rhbz790721.c @@ -42,8 +42,7 @@ #include #include "guestfs.h" - -#define STRNEQ(a,b) (strcmp((a),(b)) != 0) +#include "guestfs-internal-frontend.h" /* Number of worker threads running the test. */ #define NR_THREADS 20