Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame^] | 1 | From 0653f1d809d0cc13f84facb9d2d82d984ac4d0ac Mon Sep 17 00:00:00 2001 |
| 2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> |
| 3 | Date: Tue, 9 Mar 2021 15:25:16 +0000 |
| 4 | Subject: [PATCH 3/3] syscalls/swapon/swapoff: Move common library to libs/ |
| 5 | |
| 6 | There is a race/determinism issue with libswapon currently as depending on |
| 7 | which makefile path builds it, the debug paths may be "../swapon/libswapon.c" |
| 8 | or "libswapon.c". To avoid the determinism issue, move libswapon to libs/ |
| 9 | and use it from the shared location. |
| 10 | |
| 11 | The header is moved to the common includes directory to match and |
| 12 | the Makefile.inc fragment can be dropped. |
| 13 | |
| 14 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> |
| 15 | Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2021-March/021387.html] |
| 16 | |
| 17 | --- |
| 18 | .../kernel/syscalls/swapon => include}/libswapon.h | 0 |
| 19 | libs/libltpswapon/Makefile | 12 ++++++++++++ |
| 20 | .../swapon => libs/libltpswapon}/libswapon.c | 0 |
| 21 | testcases/kernel/syscalls/swapoff/Makefile | 7 +++++-- |
| 22 | testcases/kernel/syscalls/swapoff/Makefile.inc | 6 ------ |
| 23 | testcases/kernel/syscalls/swapoff/swapoff01.c | 2 +- |
| 24 | testcases/kernel/syscalls/swapoff/swapoff02.c | 2 +- |
| 25 | testcases/kernel/syscalls/swapon/Makefile | 6 +++--- |
| 26 | 8 files changed, 22 insertions(+), 13 deletions(-) |
| 27 | rename {testcases/kernel/syscalls/swapon => include}/libswapon.h (100%) |
| 28 | create mode 100644 libs/libltpswapon/Makefile |
| 29 | rename {testcases/kernel/syscalls/swapon => libs/libltpswapon}/libswapon.c (100%) |
| 30 | delete mode 100644 testcases/kernel/syscalls/swapoff/Makefile.inc |
| 31 | |
| 32 | diff --git a/testcases/kernel/syscalls/swapon/libswapon.h b/include/libswapon.h |
| 33 | similarity index 100% |
| 34 | rename from testcases/kernel/syscalls/swapon/libswapon.h |
| 35 | rename to include/libswapon.h |
| 36 | diff --git a/libs/libltpswapon/Makefile b/libs/libltpswapon/Makefile |
| 37 | new file mode 100644 |
| 38 | index 000000000..8f738338b |
| 39 | --- /dev/null |
| 40 | +++ b/libs/libltpswapon/Makefile |
| 41 | @@ -0,0 +1,12 @@ |
| 42 | +# SPDX-License-Identifier: GPL-2.0-or-later |
| 43 | +# |
| 44 | +# Copyright (C) Richard Purdie <richard.purdie@linuxfoundation.org> |
| 45 | + |
| 46 | +top_srcdir ?= ../.. |
| 47 | + |
| 48 | +include $(top_srcdir)/include/mk/env_pre.mk |
| 49 | + |
| 50 | +INTERNAL_LIB := libltpswapon.a |
| 51 | + |
| 52 | +include $(top_srcdir)/include/mk/lib.mk |
| 53 | +include $(top_srcdir)/include/mk/generic_leaf_target.mk |
| 54 | diff --git a/testcases/kernel/syscalls/swapon/libswapon.c b/libs/libltpswapon/libswapon.c |
| 55 | similarity index 100% |
| 56 | rename from testcases/kernel/syscalls/swapon/libswapon.c |
| 57 | rename to libs/libltpswapon/libswapon.c |
| 58 | diff --git a/testcases/kernel/syscalls/swapoff/Makefile b/testcases/kernel/syscalls/swapoff/Makefile |
| 59 | index fbfbe0441..a74374605 100644 |
| 60 | --- a/testcases/kernel/syscalls/swapoff/Makefile |
| 61 | +++ b/testcases/kernel/syscalls/swapoff/Makefile |
| 62 | @@ -3,7 +3,10 @@ |
| 63 | |
| 64 | top_srcdir ?= ../../../.. |
| 65 | |
| 66 | +LTPLIBS = ltpswapon |
| 67 | + |
| 68 | include $(top_srcdir)/include/mk/testcases.mk |
| 69 | -include $(abs_srcdir)/./Makefile.inc |
| 70 | + |
| 71 | +LTPLDLIBS = -lltpswapon |
| 72 | + |
| 73 | include $(top_srcdir)/include/mk/generic_leaf_target.mk |
| 74 | -$(MAKE_TARGETS): %: ../swapon/libswapon.o |
| 75 | diff --git a/testcases/kernel/syscalls/swapoff/Makefile.inc b/testcases/kernel/syscalls/swapoff/Makefile.inc |
| 76 | deleted file mode 100644 |
| 77 | index 65350cbeb..000000000 |
| 78 | --- a/testcases/kernel/syscalls/swapoff/Makefile.inc |
| 79 | +++ /dev/null |
| 80 | @@ -1,6 +0,0 @@ |
| 81 | -LIBDIR += ../swapon/ |
| 82 | -LIBSWAPON := $(LIBDIR)/libswapon.o |
| 83 | -$(LIBSWAPON): |
| 84 | - $(MAKE) -C $(LIBDIR) |
| 85 | -CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR) |
| 86 | -LDFLAGS += -L$(abs_builddir)/$(LIBDIR) |
| 87 | diff --git a/testcases/kernel/syscalls/swapoff/swapoff01.c b/testcases/kernel/syscalls/swapoff/swapoff01.c |
| 88 | index e115269c0..87a217a89 100644 |
| 89 | --- a/testcases/kernel/syscalls/swapoff/swapoff01.c |
| 90 | +++ b/testcases/kernel/syscalls/swapoff/swapoff01.c |
| 91 | @@ -25,7 +25,7 @@ |
| 92 | #include <stdlib.h> |
| 93 | #include "config.h" |
| 94 | #include "lapi/syscalls.h" |
| 95 | -#include "../swapon/libswapon.h" |
| 96 | +#include "libswapon.h" |
| 97 | |
| 98 | static void setup(void); |
| 99 | static void cleanup(void); |
| 100 | diff --git a/testcases/kernel/syscalls/swapoff/swapoff02.c b/testcases/kernel/syscalls/swapoff/swapoff02.c |
| 101 | index 8954f975f..60cd66c26 100644 |
| 102 | --- a/testcases/kernel/syscalls/swapoff/swapoff02.c |
| 103 | +++ b/testcases/kernel/syscalls/swapoff/swapoff02.c |
| 104 | @@ -33,7 +33,7 @@ |
| 105 | #include "test.h" |
| 106 | #include "lapi/syscalls.h" |
| 107 | #include "safe_macros.h" |
| 108 | -#include "../swapon/libswapon.h" |
| 109 | +#include "libswapon.h" |
| 110 | |
| 111 | static void setup(void); |
| 112 | static void cleanup(void); |
| 113 | diff --git a/testcases/kernel/syscalls/swapon/Makefile b/testcases/kernel/syscalls/swapon/Makefile |
| 114 | index 97113a447..57ec45d48 100644 |
| 115 | --- a/testcases/kernel/syscalls/swapon/Makefile |
| 116 | +++ b/testcases/kernel/syscalls/swapon/Makefile |
| 117 | @@ -8,10 +8,10 @@ endif |
| 118 | |
| 119 | top_srcdir ?= ../../../.. |
| 120 | |
| 121 | +LTPLIBS = ltpswapon |
| 122 | + |
| 123 | include $(top_srcdir)/include/mk/testcases.mk |
| 124 | |
| 125 | -FILTER_OUT_MAKE_TARGETS := libswapon |
| 126 | +LTPLDLIBS = -lltpswapon |
| 127 | |
| 128 | include $(top_srcdir)/include/mk/generic_leaf_target.mk |
| 129 | - |
| 130 | -$(MAKE_TARGETS): %: libswapon.o |
| 131 | -- |
| 132 | 2.27.0 |
| 133 | |