OSDN Git Service

Add check unittest support and a initial test for a resizing bug.
authorOtavio Salvador <otavio@ossystems.com.br>
Tue, 5 Dec 2006 01:40:54 +0000 (23:40 -0200)
committerOtavio Salvador <otavio@ossystems.com.br>
Tue, 5 Dec 2006 01:40:54 +0000 (23:40 -0200)
configure.ac
libparted/Makefile.am
libparted/tests/Makefile.am [new file with mode: 0644]
libparted/tests/resize.c [new file with mode: 0644]

index 8200564..5dc4ebc 100644 (file)
@@ -432,6 +432,10 @@ AC_CHECK_HEADER([execinfo.h], [
        ])
 ])
 
+dnl check for "check", unit testing library/header
+PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
+AM_CONDITIONAL(HAVE_CHECK, test "x$CHECK_LIBS" != "x")
+
 dnl Checks for typedefs, structures and compiler characteristics.
 AC_PROG_LD
 
@@ -486,6 +490,7 @@ libparted/fs/ntfs/Makefile
 libparted/fs/reiserfs/Makefile
 libparted/fs/ufs/Makefile
 libparted/fs/xfs/Makefile
+libparted/tests/Makefile
 parted/Makefile
 partprobe/Makefile
 doc/Makefile
index 0cb7c09..b071658 100644 (file)
@@ -3,7 +3,13 @@
 #
 # This file may be modified and/or distributed without restriction.
 
-SUBDIRS       = labels fs
+if HAVE_CHECK
+SUBDIRS_CHECK = tests
+else
+SUBDIRS_CHECK =
+endif
+
+SUBDIRS       = labels fs . $(SUBDIRS_CHECK)
 
 LIBS = @INTLLIBS@ @LIBS@
 
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
new file mode 100644 (file)
index 0000000..c4e66e5
--- /dev/null
@@ -0,0 +1,11 @@
+# This file is part of GNU Parted
+# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+#
+# This file may be modified and/or distributed without restriction.
+
+TESTS = resize
+bin_PROGRAMS     = resize
+resize_CFLAGS    = @CHECK_CFLAGS@ -I$(top_srcdir)/include
+resize_LDADD     = @CHECK_LIBS@ $(top_builddir)/libparted/libparted.la
+resize_SOURCES   = resize.c
+
diff --git a/libparted/tests/resize.c b/libparted/tests/resize.c
new file mode 100644 (file)
index 0000000..761f81a
--- /dev/null
@@ -0,0 +1,27 @@
+#include <parted/parted.h>
+#include <check.h>
+
+START_TEST (test_start_sector)
+{
+               fail_unless(0 == 0, "Erro proposital");
+}
+END_TEST               
+
+int main(void)
+{
+               int number_failed;
+               Suite *suite = suite_create( "Resize" );
+               TCase *basic = tcase_create( "Basic" );
+               
+               tcase_add_test( basic, test_start_sector );
+               suite_add_tcase( suite, basic );
+
+               SRunner *srunner = srunner_create( suite );
+               srunner_run_all( srunner, CK_VERBOSE );
+
+               number_failed = srunner_ntests_failed( srunner );
+               srunner_free(srunner);
+               
+               return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+