All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests] makefile: Add install rule
@ 2018-11-09 15:15 Gwendal Grignou
  2018-11-14 18:26 ` Omar Sandoval
  0 siblings, 1 reply; 5+ messages in thread
From: Gwendal Grignou @ 2018-11-09 15:15 UTC (permalink / raw)
  To: osandov; +Cc: linux-block

Add rule to install to a target directory, /usr/local/blktests by
default.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 Makefile     | 9 +++++++++
 src/Makefile | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/Makefile b/Makefile
index 38b8ad1..d7c2b74 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,18 @@
+prefix ?= /usr/local
+dest = $(DESTDIR)$(prefix)/blktests
+
 all:
 	$(MAKE) -C src all
 
 clean:
 	$(MAKE) -C src clean
 
+install:
+	install -m755 -d $(dest)
+	install check $(dest)
+	cp -R tests common $(dest)
+	$(MAKE) -C src dest=$(dest) install
+
 # SC2119: "Use foo "$@" if function's $1 should mean script's $1". False
 # positives on helpers like _init_scsi_debug.
 SHELLCHECK_EXCLUDE := SC2119
diff --git a/src/Makefile b/src/Makefile
index 15c1022..f0ddbb5 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,6 +20,9 @@ all: $(TARGETS)
 clean:
 	rm -f $(TARGETS)
 
+install: $(TARGETS)
+	install $(TARGETS) $(dest)
+
 $(C_TARGETS): %: %.c
 	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
 
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH blktests] makefile: Add install rule
  2018-11-09 15:15 [PATCH blktests] makefile: Add install rule Gwendal Grignou
@ 2018-11-14 18:26 ` Omar Sandoval
  2018-11-14 19:37   ` Gwendal Grignou
  0 siblings, 1 reply; 5+ messages in thread
From: Omar Sandoval @ 2018-11-14 18:26 UTC (permalink / raw)
  To: Gwendal Grignou; +Cc: osandov, linux-block

On Fri, Nov 09, 2018 at 07:15:24AM -0800, Gwendal Grignou wrote:
> Add rule to install to a target directory, /usr/local/blktests by
> default.

This seems reasonale, but I'm curious, what's your use case?

> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>  Makefile     | 9 +++++++++
>  src/Makefile | 3 +++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 38b8ad1..d7c2b74 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,9 +1,18 @@
> +prefix ?= /usr/local
> +dest = $(DESTDIR)$(prefix)/blktests
> +
>  all:
>  	$(MAKE) -C src all
>  
>  clean:
>  	$(MAKE) -C src clean
>  
> +install:

install should be added to the .PHONY targets.

> +	install -m755 -d $(dest)
> +	install check $(dest)
> +	cp -R tests common $(dest)
> +	$(MAKE) -C src dest=$(dest) install

The src programs need to be installed to $(dest)/src.

>  # SC2119: "Use foo "$@" if function's $1 should mean script's $1". False
>  # positives on helpers like _init_scsi_debug.
>  SHELLCHECK_EXCLUDE := SC2119
> diff --git a/src/Makefile b/src/Makefile
> index 15c1022..f0ddbb5 100644
> --- a/src/Makefile
> +++ b/src/Makefile
> @@ -20,6 +20,9 @@ all: $(TARGETS)
>  clean:
>  	rm -f $(TARGETS)
>  
> +install: $(TARGETS)
> +	install $(TARGETS) $(dest)
> +
>  $(C_TARGETS): %: %.c
>  	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^

This ability to install tests could also use a mention in the README.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH blktests] makefile: Add install rule
  2018-11-14 18:26 ` Omar Sandoval
@ 2018-11-14 19:37   ` Gwendal Grignou
  2018-11-14 19:39     ` [PATCH v2] " Gwendal Grignou
  0 siblings, 1 reply; 5+ messages in thread
From: Gwendal Grignou @ 2018-11-14 19:37 UTC (permalink / raw)
  To: osandov; +Cc: osandov, linux-block

On Wed, Nov 14, 2018 at 10:26 AM Omar Sandoval <osandov@osandov.com> wrote:
>
> On Fri, Nov 09, 2018 at 07:15:24AM -0800, Gwendal Grignou wrote:
> > Add rule to install to a target directory, /usr/local/blktests by
> > default.
>
> This seems reasonale, but I'm curious, what's your use case?
I will use blktest to check chromebooks kernel. ChromeOS is using
Gentoo tool like emerge to [cros-]compile a package that is then
integrated in a [test] image.
You can see the ebuild I am currently using for building a blktest
package at https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/1329948
It needs an install rule to move the tests and common file from the
source directory to the destination directory we will use to produce
an image.

Thans,

Gwendal.
>
> > Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> > ---
> >  Makefile     | 9 +++++++++
> >  src/Makefile | 3 +++
> >  2 files changed, 12 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 38b8ad1..d7c2b74 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1,9 +1,18 @@
> > +prefix ?= /usr/local
> > +dest = $(DESTDIR)$(prefix)/blktests
> > +
> >  all:
> >       $(MAKE) -C src all
> >
> >  clean:
> >       $(MAKE) -C src clean
> >
> > +install:
>
> install should be added to the .PHONY targets.
done
>
> > +     install -m755 -d $(dest)
> > +     install check $(dest)
> > +     cp -R tests common $(dest)
> > +     $(MAKE) -C src dest=$(dest) install
>
> The src programs need to be installed to $(dest)/src.
done
>
> >  # SC2119: "Use foo "$@" if function's $1 should mean script's $1". False
> >  # positives on helpers like _init_scsi_debug.
> >  SHELLCHECK_EXCLUDE := SC2119
> > diff --git a/src/Makefile b/src/Makefile
> > index 15c1022..f0ddbb5 100644
> > --- a/src/Makefile
> > +++ b/src/Makefile
> > @@ -20,6 +20,9 @@ all: $(TARGETS)
> >  clean:
> >       rm -f $(TARGETS)
> >
> > +install: $(TARGETS)
> > +     install $(TARGETS) $(dest)
> > +
> >  $(C_TARGETS): %: %.c
> >       $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
>
> This ability to install tests could also use a mention in the README.
done

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] makefile: Add install rule
  2018-11-14 19:37   ` Gwendal Grignou
@ 2018-11-14 19:39     ` Gwendal Grignou
  2018-11-14 19:46       ` Omar Sandoval
  0 siblings, 1 reply; 5+ messages in thread
From: Gwendal Grignou @ 2018-11-14 19:39 UTC (permalink / raw)
  To: osandov; +Cc: osandov, linux-block

Add rule to install to a target directory, /usr/local/blktests by
default.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 Makefile     | 11 ++++++++++-
 README.md    |  3 +++
 src/Makefile |  6 +++++-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 38b8ad1..9793a2d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,18 @@
+prefix ?= /usr/local
+dest = $(DESTDIR)$(prefix)/blktests
+
 all:
 	$(MAKE) -C src all
 
 clean:
 	$(MAKE) -C src clean
 
+install:
+	install -m755 -d $(dest)
+	install check $(dest)
+	cp -R tests common $(dest)
+	$(MAKE) -C src dest=$(dest)/src install
+
 # SC2119: "Use foo "$@" if function's $1 should mean script's $1". False
 # positives on helpers like _init_scsi_debug.
 SHELLCHECK_EXCLUDE := SC2119
@@ -13,4 +22,4 @@ check:
 		tests/*/rc tests/*/[0-9]*[0-9]
 	! grep TODO tests/*/rc tests/*/[0-9]*[0-9]
 
-.PHONY: all check
+.PHONY: all check install
diff --git a/README.md b/README.md
index be55aba..7967569 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,9 @@ Some tests require the following:
 - multipath-tools (Debian, openSUSE) or device-mapper-multipath (Fedora)
 - dmsetup (Debian) or device-mapper (Fedora, openSUSE, Arch Linux)
 
+Build blktests with `make install`. Optionally, install it to a known location
+with `make install`, `/usr/local/blktests` by default.
+
 Add the list of block devices you want to test on in a file named `config`:
 
 ```sh
diff --git a/src/Makefile b/src/Makefile
index 15c1022..b2bd321 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,10 +20,14 @@ all: $(TARGETS)
 clean:
 	rm -f $(TARGETS)
 
+install: $(TARGETS)
+	install -m755 -d $(dest)
+	install $(TARGETS) $(dest)
+
 $(C_TARGETS): %: %.c
 	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
 
 $(CXX_TARGETS): %: %.cpp
 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^
 
-.PHONY: all clean
+.PHONY: all clean install
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] makefile: Add install rule
  2018-11-14 19:39     ` [PATCH v2] " Gwendal Grignou
@ 2018-11-14 19:46       ` Omar Sandoval
  0 siblings, 0 replies; 5+ messages in thread
From: Omar Sandoval @ 2018-11-14 19:46 UTC (permalink / raw)
  To: Gwendal Grignou; +Cc: osandov, linux-block

On Wed, Nov 14, 2018 at 11:39:31AM -0800, Gwendal Grignou wrote:
> Add rule to install to a target directory, /usr/local/blktests by
> default.
> 
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>

Pushed with a slightly expanded description in the README. Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-14 19:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-09 15:15 [PATCH blktests] makefile: Add install rule Gwendal Grignou
2018-11-14 18:26 ` Omar Sandoval
2018-11-14 19:37   ` Gwendal Grignou
2018-11-14 19:39     ` [PATCH v2] " Gwendal Grignou
2018-11-14 19:46       ` Omar Sandoval

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.