summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/crypt/.cvsignore1
-rw-r--r--test/crypt/Makefile15
-rw-r--r--test/crypt/md5c-test.c19
3 files changed, 33 insertions, 2 deletions
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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <crypt.h>
+
+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;
+}