tests: Move libtestcommon to utils
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 13 Jun 2019 18:10:51 +0000 (14:10 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 13 Jun 2019 23:47:13 +0000 (19:47 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I4efe6edae5d70921cbfb106f5184c58f7e2e5abb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1426
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
tests/lib/Makefile.am
tests/lib/common.c [deleted file]
tests/lib/common.h [deleted file]
tests/utils/Makefile.am
tests/utils/common.c [new file with mode: 0644]
tests/utils/common.h [new file with mode: 0644]

index 679fda2b148e4104776756ccca0fbd0736c3ec78..16616ccfe4519ec59c4d473fa5ccf3a10ca3b446 100644 (file)
@@ -2,14 +2,11 @@ SUBDIRS =
 
 AM_CPPFLAGS += -I$(top_srcdir)/tests/utils
 
-LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la
+COMMON_TEST_LDADD = \
+       $(top_builddir)/tests/utils/tap/libtap.la \
+       $(top_builddir)/tests/utils/libtestcommon.la
 
-libtestcommon_la_SOURCES = common.c common.h
-noinst_LTLIBRARIES = libtestcommon.la
-
-COMMON_TEST_LDADD = $(LIBTAP) $(builddir)/libtestcommon.la
-
-test_bitfield_LDADD = $(LIBTAP) $(builddir)/libtestcommon.la
+test_bitfield_LDADD = $(COMMON_TEST_LDADD)
 
 test_ctf_writer_LDADD = \
        $(COMMON_TEST_LDADD) \
diff --git a/tests/lib/common.c b/tests/lib/common.c
deleted file mode 100644 (file)
index 1878d77..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * common.c
- *
- * Lib BabelTrace - Common function to all tests
- *
- * Copyright 2012 - Yannick Brosseau <yannick.brosseau@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <dirent.h>
-#include <ftw.h>
-
-#define RMDIR_NFDOPEN 8
-
-static
-int nftw_recursive_rmdir(const char *file, const struct stat *sb, int flag,
-               struct FTW *s)
-{
-       switch (flag) {
-       case FTW_F:
-               unlink(file);
-               break;
-       case FTW_DP:
-               rmdir(file);
-               break;
-       }
-
-       return 0;
-}
-
-void recursive_rmdir(const char *path)
-{
-       int nftw_flags = FTW_PHYS | FTW_DEPTH;
-
-       nftw(path, nftw_recursive_rmdir, RMDIR_NFDOPEN, nftw_flags);
-}
diff --git a/tests/lib/common.h b/tests/lib/common.h
deleted file mode 100644 (file)
index daa224f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * common.h
- *
- * Lib BabelTrace - Common function to all tests
- *
- * Copyright 2012 - Yannick Brosseau <yannick.brosseau@gmail.com>
- * Copyright 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef _TESTS_COMMON_H
-#define _TESTS_COMMON_H
-
-struct bt_context;
-
-void recursive_rmdir(const char *path);
-
-#endif /* _TESTS_COMMON_H */
index c23292e23d3aaa8e0e7e1149f2c46808fd294ada..d010e2b00f8088b76eb3d6e32ee651572dcb4eac 100644 (file)
@@ -1,3 +1,7 @@
 SUBDIRS = tap
+
+noinst_LTLIBRARIES = libtestcommon.la
+libtestcommon_la_SOURCES = common.c common.h
+
 # Directories added to EXTRA_DIST will be recursively copied to the distribution.
 EXTRA_DIST = python
diff --git a/tests/utils/common.c b/tests/utils/common.c
new file mode 100644 (file)
index 0000000..1878d77
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * common.c
+ *
+ * Lib BabelTrace - Common function to all tests
+ *
+ * Copyright 2012 - Yannick Brosseau <yannick.brosseau@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <ftw.h>
+
+#define RMDIR_NFDOPEN 8
+
+static
+int nftw_recursive_rmdir(const char *file, const struct stat *sb, int flag,
+               struct FTW *s)
+{
+       switch (flag) {
+       case FTW_F:
+               unlink(file);
+               break;
+       case FTW_DP:
+               rmdir(file);
+               break;
+       }
+
+       return 0;
+}
+
+void recursive_rmdir(const char *path)
+{
+       int nftw_flags = FTW_PHYS | FTW_DEPTH;
+
+       nftw(path, nftw_recursive_rmdir, RMDIR_NFDOPEN, nftw_flags);
+}
diff --git a/tests/utils/common.h b/tests/utils/common.h
new file mode 100644 (file)
index 0000000..daa224f
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * common.h
+ *
+ * Lib BabelTrace - Common function to all tests
+ *
+ * Copyright 2012 - Yannick Brosseau <yannick.brosseau@gmail.com>
+ * Copyright 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef _TESTS_COMMON_H
+#define _TESTS_COMMON_H
+
+struct bt_context;
+
+void recursive_rmdir(const char *path);
+
+#endif /* _TESTS_COMMON_H */
This page took 0.028306 seconds and 4 git commands to generate.