From 75e3848d490f4a8381b7d73e2f6444b22eeeed34 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 26 Feb 2002 15:29:24 +0000 Subject: Add an md5crypt test --- test/crypt/.cvsignore | 1 + test/crypt/Makefile | 15 +++++++++++++-- test/crypt/md5c-test.c | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 test/crypt/md5c-test.c (limited to 'test') diff --git a/test/crypt/.cvsignore b/test/crypt/.cvsignore index b93603d7b..559a97a2a 100644 --- a/test/crypt/.cvsignore +++ b/test/crypt/.cvsignore @@ -2,3 +2,4 @@ crypt crypt.out crypt_glibc crypt_glibc.out +md5c-test diff --git a/test/crypt/Makefile b/test/crypt/Makefile index 97a7cfcc4..fe743aa45 100644 --- a/test/crypt/Makefile +++ b/test/crypt/Makefile @@ -21,7 +21,7 @@ TESTDIR=../ include $(TESTDIR)/Rules.mak -TARGETS=diff +TARGETS=diff md5c-test EXTRA_LIBS=-lcrypt all: $(TARGETS) @@ -56,7 +56,18 @@ diff: crypt_glibc crypt -diff -u crypt_glibc.out crypt.out -@ echo " " +md5c-test: md5c-test.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC) + -@ echo "-------" + -@ echo " " + -@ echo "Compiling vs uClibc: " + -@ echo " " + $(CC) $(CFLAGS) -c $< -o $@.o + $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) + $(STRIPTOOL) -x -R .note -R .comment $@ + -./$@ + -@ echo " " + clean: - rm -f *.[oa] *~ core crypt_glibc crypt crypt_glibc.out crypt.out + rm -f *.[oa] *~ core crypt_glibc crypt crypt_glibc.out crypt.out md5c-test diff --git a/test/crypt/md5c-test.c b/test/crypt/md5c-test.c new file mode 100644 index 000000000..e2896b5b1 --- /dev/null +++ b/test/crypt/md5c-test.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + const char salt[] = "$1$saltstring"; + char *cp; + + cp = crypt ("Hello world!", salt); + if (strcmp ("$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1", cp)) { + fprintf(stderr, "Failed md5 crypt test!\n"); + return EXIT_FAILURE; + } + fprintf(stderr, "Passed md5 crypt test!\n"); + return EXIT_SUCCESS; +} -- cgit v1.2.3