From: Richard W.M. Jones Date: Thu, 9 Jan 2014 14:03:45 +0000 (+0000) Subject: Various fixes. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=3bb8ad15e44d5247c678a8fe273f4b8f33fde116;hp=d7a6ef4a1763f543d43855ff9cfb902d95f2f431;p=watchdog-test-framework.git Various fixes. --- diff --git a/Makefile b/Makefile index acc7597..f221823 100644 --- a/Makefile +++ b/Makefile @@ -15,10 +15,16 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +CC = gcc +CFLAGS = -Wall + all: watchdog-test clean: rm -f watchdog-test *~ watchdog-test: watchdog-test.o - $(CC) -static $< -o $@ + $(CC) $(CFLAGS) -static $< -o $@ + +.c.o: + $(CC) $(CFLAGS) -c $< -o $@ diff --git a/README b/README index 629257c..62e1c1d 100644 --- a/README +++ b/README @@ -29,8 +29,14 @@ model can be either 'i6300esb' or 'ib700'. action can be: 'reset', 'shutdown', 'poweroff', 'pause', 'none' or 'dump' -(4) Install the statically linked watchdog-test binary in a Linux +(4) Install the statically linked watchdog-test binary in the Linux guest. -(5) Boot up the guest. Log into the guest, run the watchdog-test -binary (as root), and follow instructions. +(5) Boot up the guest. Log into the guest. + +(6) [ib700 only] You have to load the ib700wdt kernel module manually +since it's an ISA device: + + sudo modprobe ib700wdt + +(7) Run the watchdog-test binary (as root), and follow instructions. diff --git a/watchdog-test.c b/watchdog-test.c index de855a8..d4e6305 100644 --- a/watchdog-test.c +++ b/watchdog-test.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -30,7 +31,7 @@ int main () { - int fd, i; + int fd; int timeout; char input[256]; time_t start_t, t; @@ -56,7 +57,7 @@ main () printf ("Do you want to start the test? Type \"yes\" without quotes:\n"); if (fgets (input, sizeof input, stdin) == NULL || - strcmp (input, "yes") != 0) { + strncmp (input, "yes", 3) != 0) { printf ("Exiting the program.\n"); exit (EXIT_SUCCESS); } @@ -81,7 +82,7 @@ main () if (ioctl (fd, WDIOC_GETTIMEOUT, &timeout) == -1) perror ("ioctl: WDIOC_GETTIMEOUT"); else { - printf ("Timeout is set to %d seconds.\n"); + printf ("Timeout is set to %d seconds.\n", timeout); if (timeout != WATCHDOG_TIMEOUT) printf ("Note: some watchdog devices don't support setting exact timeout values.\n"); } @@ -101,14 +102,16 @@ main () sleep (3); + printf ("ping "); if (ioctl (fd, WDIOC_KEEPALIVE, 0) == -1) - perror ("ioctl: WDIOC_KEEPALIVE"); - printf ("* "); + perror ("\nioctl: WDIOC_KEEPALIVE"); } printf ("\n"); + printf ("\n"); printf ("Stopping pings.\n"); - printf ("The watchdog action should happen at around %d mark.\n"); + printf ("The watchdog action should happen at approximately %d second mark.\n", + WATCHDOG_TIMEOUT); printf ("\n"); time (&start_t);