From 69c2a603fada718d34a13d03e12322a5b1795eeb Mon Sep 17 00:00:00 2001 From: Jon Schlueter Date: Wed, 25 Mar 2015 15:30:35 -0400 Subject: Fixing broken minimal=on for test_libgps scons minimal=on leapfetch=off python=on test_libgps failed Missing guards for CLIENTDEBUG_ENABLE and SOCKET_EXPORT_ENABLE in test_libgps.c --- test_libgps.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test_libgps.c') diff --git a/test_libgps.c b/test_libgps.c index 1dfb15a1..1d4bcc4e 100644 --- a/test_libgps.c +++ b/test_libgps.c @@ -26,8 +26,10 @@ static void onsig(int sig) exit(EXIT_FAILURE); } +#ifdef SOCKET_EXPORT_ENABLE /* must start zeroed, otherwise the unit test will try to chase garbage pointer fields. */ static struct gps_data_t gpsdata; +#endif int main(int argc, char *argv[]) { @@ -35,7 +37,9 @@ int main(int argc, char *argv[]) char buf[BUFSIZ]; int option; bool batchmode = false; +#ifdef CLIENTDEBUG_ENABLE int debug = 0; +#endif (void)signal(SIGSEGV, onsig); (void)signal(SIGBUS, onsig); @@ -56,9 +60,11 @@ int main(int argc, char *argv[]) sizeof(collect.devices), sizeof(struct policy_t), sizeof(struct version_t), sizeof(struct gst_t)); exit(EXIT_SUCCESS); +#ifdef CLIENTDEBUG_ENABLE case 'D': debug = atoi(optarg); break; +#endif case '?': case 'h': default: @@ -67,14 +73,18 @@ int main(int argc, char *argv[]) } } +#ifdef CLIENTDEBUG_ENABLE gps_enable_debug(debug, stdout); +#endif if (batchmode) { +#ifdef SOCKET_EXPORT_ENABLE while (fgets(buf, sizeof(buf), stdin) != NULL) { if (buf[0] == '{' || isalpha(buf[0])) { gps_unpack(buf, &gpsdata); libgps_dump_state(&gpsdata); } } +#endif } else if (gps_open(NULL, 0, &collect) <= 0) { (void)fputs("Daemon is not running.\n", stdout); exit(EXIT_FAILURE); @@ -83,7 +93,9 @@ int main(int argc, char *argv[]) (void)strlcat(buf, "\n", sizeof(buf)); (void)gps_send(&collect, buf); (void)gps_read(&collect); +#ifdef SOCKET_EXPORT_ENABLE libgps_dump_state(&collect); +#endif (void)gps_close(&collect); } else { int tty = isatty(0); @@ -101,7 +113,9 @@ int main(int argc, char *argv[]) collect.set = 0; (void)gps_send(&collect, buf); (void)gps_read(&collect); +#ifdef SOCKET_EXPORT_ENABLE libgps_dump_state(&collect); +#endif } (void)gps_close(&collect); } -- cgit v1.2.1