aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-01-20 18:19:27 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-01-20 18:19:27 +1100
commit721e826e6fddc77c64f6519c7878bf2046c37ca3 (patch)
tree14842c21c0a02d5a6c72b29bee49e69e34d9971b /libc
parent01809dfb1f59cc494994082e259fcadff60830d7 (diff)
downloadskiboot-721e826e6fddc77c64f6519c7878bf2046c37ca3.zip
skiboot-721e826e6fddc77c64f6519c7878bf2046c37ca3.tar.gz
skiboot-721e826e6fddc77c64f6519c7878bf2046c37ca3.tar.bz2
Skeleton unit tests for libc memops (libc/string/*)
This means that it shows up in lcov as untested. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/test/Makefile.check2
-rw-r--r--libc/test/run-memops-test.c43
-rw-r--r--libc/test/run-memops.c27
3 files changed, 71 insertions, 1 deletions
diff --git a/libc/test/Makefile.check b/libc/test/Makefile.check
index 6247e30..faebd86 100644
--- a/libc/test/Makefile.check
+++ b/libc/test/Makefile.check
@@ -4,7 +4,7 @@ LIBC_TEST := libc/test/run-time
# We have some tricky tests that have system libc and skiboot libc,
# so that we can test parts of skiboot libc but in userspace.
-LIBC_DUALLIB_TEST := libc/test/run-snprintf
+LIBC_DUALLIB_TEST := libc/test/run-snprintf libc/test/run-memops
LCOV_EXCLUDE += $(LIBC_TEST:%=%.c) $(LIBC_DUALLIB_TEST:%=%.c) $(LIBC_DUALLIB_TEST:%=%-test.c)
diff --git a/libc/test/run-memops-test.c b/libc/test/run-memops-test.c
new file mode 100644
index 0000000..0979994
--- /dev/null
+++ b/libc/test/run-memops-test.c
@@ -0,0 +1,43 @@
+/* Copyright 2013-2015 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file is run with the skiboot libc files rather than system libc.
+ * This means we have a bit of "fun" with actually executing the tests on
+ * the host.
+ * Patches to make this less ugly are very welcome.
+ */
+
+#include <config.h>
+#include <stdarg.h>
+
+#include "../string/memchr.c"
+#include "../string/memcmp.c"
+#include "../string/memcpy.c"
+#include "../string/memmove.c"
+#include "../string/memset.c"
+#include "../string/strcasecmp.c"
+#include "../string/strcat.c"
+#include "../string/strchr.c"
+#include "../string/strcmp.c"
+#include "../string/strcpy.c"
+/* #include "../string/strdup.c" */
+#include "../string/strlen.c"
+#include "../string/strncasecmp.c"
+#include "../string/strncmp.c"
+#include "../string/strncpy.c"
+#include "../string/strstr.c"
+#include "../string/strtok.c"
diff --git a/libc/test/run-memops.c b/libc/test/run-memops.c
new file mode 100644
index 0000000..15ec9bd
--- /dev/null
+++ b/libc/test/run-memops.c
@@ -0,0 +1,27 @@
+/* Copyright 2013-2015 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define BUFSZ 50
+
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+
+int main(void)
+{
+ return 0;
+}