linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUGFIX PATCH] selftests: Use real temporary working directory for archiving
@ 2019-10-04  5:13 Masami Hiramatsu
  2019-10-04 16:34 ` Jassi Brar
  2019-10-08 23:39 ` Tim.Bird
  0 siblings, 2 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2019-10-04  5:13 UTC (permalink / raw)
  To: Shuah Khan; +Cc: linux-kselftest, linux-kernel, jaswinder.singh

Use real temporary working directory for generating kselftest
archive.

tools/testing/selftests/kselftest directory has been used for
the temporary working directory for making a tar archive from
gen_kselftest_tar.sh, and it removes the directory for cleanup.

However, since the kselftest directory became a part of the
repository, it must not be used as a working dir.

Introduce mktemp to prepare a temporary working directory
for archiving kselftests.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 tools/testing/selftests/gen_kselftest_tar.sh |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/gen_kselftest_tar.sh b/tools/testing/selftests/gen_kselftest_tar.sh
index a27e2eec3586..eba1e9987ffc 100755
--- a/tools/testing/selftests/gen_kselftest_tar.sh
+++ b/tools/testing/selftests/gen_kselftest_tar.sh
@@ -38,16 +38,16 @@ main()
 	esac
 	fi
 
-	install_dir=./kselftest
+	tmpdir=`mktemp -d ./install-XXXXXX` || exit 1
 
 # Run install using INSTALL_KSFT_PATH override to generate install
 # directory
-./kselftest_install.sh
-tar $copts kselftest${ext} $install_dir
+./kselftest_install.sh $tmpdir
+tar $copts kselftest${ext} -C $tmpdir kselftest
 echo "Kselftest archive kselftest${ext} created!"
 
 # clean up install directory
-rm -rf kselftest
+rm -rf $tmpdir
 }
 
 main "$@"


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

* Re: [BUGFIX PATCH] selftests: Use real temporary working directory for archiving
  2019-10-04  5:13 [BUGFIX PATCH] selftests: Use real temporary working directory for archiving Masami Hiramatsu
@ 2019-10-04 16:34 ` Jassi Brar
  2019-10-08 23:39 ` Tim.Bird
  1 sibling, 0 replies; 4+ messages in thread
From: Jassi Brar @ 2019-10-04 16:34 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: Shuah Khan, linux-kselftest, lkml

On Fri, 4 Oct 2019 at 00:13, Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> Use real temporary working directory for generating kselftest
> archive.
>
> tools/testing/selftests/kselftest directory has been used for
> the temporary working directory for making a tar archive from
> gen_kselftest_tar.sh, and it removes the directory for cleanup.
>
> However, since the kselftest directory became a part of the
> repository, it must not be used as a working dir.
>
> Introduce mktemp to prepare a temporary working directory
> for archiving kselftests.
>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  tools/testing/selftests/gen_kselftest_tar.sh |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/gen_kselftest_tar.sh b/tools/testing/selftests/gen_kselftest_tar.sh
> index a27e2eec3586..eba1e9987ffc 100755
> --- a/tools/testing/selftests/gen_kselftest_tar.sh
> +++ b/tools/testing/selftests/gen_kselftest_tar.sh
> @@ -38,16 +38,16 @@ main()
>         esac
>         fi
>
> -       install_dir=./kselftest
> +       tmpdir=`mktemp -d ./install-XXXXXX` || exit 1
>
>  # Run install using INSTALL_KSFT_PATH override to generate install
>  # directory
> -./kselftest_install.sh
> -tar $copts kselftest${ext} $install_dir
> +./kselftest_install.sh $tmpdir
> +tar $copts kselftest${ext} -C $tmpdir kselftest
>  echo "Kselftest archive kselftest${ext} created!"
>
>  # clean up install directory
> -rm -rf kselftest
> +rm -rf $tmpdir
>  }
>
>  main "$@"
>
FWIW,  Acked-by: Jassi Brar <jaswinder.singh@linaro.org>

-- 
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106  -
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog

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

* RE: [BUGFIX PATCH] selftests: Use real temporary working directory for archiving
  2019-10-04  5:13 [BUGFIX PATCH] selftests: Use real temporary working directory for archiving Masami Hiramatsu
  2019-10-04 16:34 ` Jassi Brar
@ 2019-10-08 23:39 ` Tim.Bird
  2019-10-09  2:44   ` Masami Hiramatsu
  1 sibling, 1 reply; 4+ messages in thread
From: Tim.Bird @ 2019-10-08 23:39 UTC (permalink / raw)
  To: mhiramat, shuah; +Cc: linux-kselftest, linux-kernel, jaswinder.singh



> -----Original Message-----
> From: Masami Hiramatsu on Thursday, October 03, 2019 7:13 PM
> 
> Use real temporary working directory for generating kselftest
> archive.
> 
> tools/testing/selftests/kselftest directory has been used for
> the temporary working directory for making a tar archive from
> gen_kselftest_tar.sh, and it removes the directory for cleanup.
> 
> However, since the kselftest directory became a part of the
> repository, it must not be used as a working dir.

I'm not objecting to the test, but I would like to understand this
point better.  Under normal circumstances (i.e. when not using O= or KBUILD_OUTPUT)
the rest of the kernel directory structure holds generated files.
What is the issue with using kselftest to hold generated files?
 -- Tim

> 
> Introduce mktemp to prepare a temporary working directory
> for archiving kselftests.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  tools/testing/selftests/gen_kselftest_tar.sh |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/gen_kselftest_tar.sh
> b/tools/testing/selftests/gen_kselftest_tar.sh
> index a27e2eec3586..eba1e9987ffc 100755
> --- a/tools/testing/selftests/gen_kselftest_tar.sh
> +++ b/tools/testing/selftests/gen_kselftest_tar.sh
> @@ -38,16 +38,16 @@ main()
>  	esac
>  	fi
> 
> -	install_dir=./kselftest
> +	tmpdir=`mktemp -d ./install-XXXXXX` || exit 1
> 
>  # Run install using INSTALL_KSFT_PATH override to generate install
>  # directory
> -./kselftest_install.sh
> -tar $copts kselftest${ext} $install_dir
> +./kselftest_install.sh $tmpdir
> +tar $copts kselftest${ext} -C $tmpdir kselftest
>  echo "Kselftest archive kselftest${ext} created!"
> 
>  # clean up install directory
> -rm -rf kselftest
> +rm -rf $tmpdir
>  }
> 
>  main "$@"


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

* Re: [BUGFIX PATCH] selftests: Use real temporary working directory for archiving
  2019-10-08 23:39 ` Tim.Bird
@ 2019-10-09  2:44   ` Masami Hiramatsu
  0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2019-10-09  2:44 UTC (permalink / raw)
  To: Tim.Bird; +Cc: shuah, linux-kselftest, linux-kernel, jaswinder.singh

On Tue, 8 Oct 2019 23:39:40 +0000
<Tim.Bird@sony.com> wrote:

> 
> 
> > -----Original Message-----
> > From: Masami Hiramatsu on Thursday, October 03, 2019 7:13 PM
> > 
> > Use real temporary working directory for generating kselftest
> > archive.
> > 
> > tools/testing/selftests/kselftest directory has been used for
> > the temporary working directory for making a tar archive from
> > gen_kselftest_tar.sh, and it removes the directory for cleanup.
> > 
> > However, since the kselftest directory became a part of the
> > repository, it must not be used as a working dir.
> 
> I'm not objecting to the test, but I would like to understand this
> point better.  Under normal circumstances (i.e. when not using O= or KBUILD_OUTPUT)
> the rest of the kernel directory structure holds generated files.
> What is the issue with using kselftest to hold generated files?

OK, after running ./gen_kselftest_tar.sh in tools/testing/selftests,
I found there is no tools/testing/selftests/kselftest was there.
Actually, this was found when I searched "runner.sh" on the tree
after building kselftest.tar.gz. I couldn't find it and realized that
the gen_kselftest_tar.sh removed kselftest directory.

This is not happen if you run gen_kselftest_tar.sh.

Thank you,

>  -- Tim
> 
> > 
> > Introduce mktemp to prepare a temporary working directory
> > for archiving kselftests.
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  tools/testing/selftests/gen_kselftest_tar.sh |    8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/gen_kselftest_tar.sh
> > b/tools/testing/selftests/gen_kselftest_tar.sh
> > index a27e2eec3586..eba1e9987ffc 100755
> > --- a/tools/testing/selftests/gen_kselftest_tar.sh
> > +++ b/tools/testing/selftests/gen_kselftest_tar.sh
> > @@ -38,16 +38,16 @@ main()
> >  	esac
> >  	fi
> > 
> > -	install_dir=./kselftest
> > +	tmpdir=`mktemp -d ./install-XXXXXX` || exit 1
> > 
> >  # Run install using INSTALL_KSFT_PATH override to generate install
> >  # directory
> > -./kselftest_install.sh
> > -tar $copts kselftest${ext} $install_dir
> > +./kselftest_install.sh $tmpdir
> > +tar $copts kselftest${ext} -C $tmpdir kselftest
> >  echo "Kselftest archive kselftest${ext} created!"
> > 
> >  # clean up install directory
> > -rm -rf kselftest
> > +rm -rf $tmpdir
> >  }
> > 
> >  main "$@"
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

end of thread, other threads:[~2019-10-09  2:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04  5:13 [BUGFIX PATCH] selftests: Use real temporary working directory for archiving Masami Hiramatsu
2019-10-04 16:34 ` Jassi Brar
2019-10-08 23:39 ` Tim.Bird
2019-10-09  2:44   ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).