-
Notifications
You must be signed in to change notification settings - Fork 2
[RFC] gunit: add installcheck #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[RFC] gunit: add installcheck #60
Conversation
Add support for installing testcases, so that the users can run it later after installation too. The installcheck hook is part of GNU automake and under the hook, gtest binary gets build and copied over to $(libdir)/libcgroup/tests/, along with its dependent library googletest/libgtest.so. Currently, the gtest is built/run with make check. While building it uses -rpath to link with <libcgroup source>/googletest/../libgtest.so. Just copying over the binary/library might fail to run, if the libcgroup sources are removed, to address this issue an extra -rpath of install the destination is pre-pended during linking. Fixes: libcgroup/libcgroup#60 Suggested-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
|
That appears to be abusing In cross-compiled environments, you can't run the test suite, so |
|
@rossburton Thanks for the review. Agree, I missed that cross-compiling environment, the reason for this feature, while getting it to work. Sorry for the noise. |
|
We could make it a part of |
|
The idea is to have a configure flag @rossburton where does the |
|
At a glance this looks good, thanks. I’m literally going on holiday this morning for two weeks so can give more feedback when I return.
… On 2 Aug 2022, at 09:07, Kamalesh Babulal ***@***.***> wrote:
The idea is to have a configure flag --enable-tests-install, which is disabled by default, and once enabled it will build the test sources and install them using the make install via install-exec-hook. Please let me know your thought on it.
@rossburton where does the libgtest.so gets generated in your cross-compilation,
in googletest or googlemock/gtest/? If it gets generated in the latter then that path
also needs to be included in the Library path and -rpath.
diff --git a/configure.ac b/configure.ac
index b68c655..9413283 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,6 +146,18 @@ AC_ARG_ENABLE([tests],
[with_tests=true])
AM_CONDITIONAL([WITH_TESTS], [test x$with_tests = xtrue])
+AC_ARG_ENABLE([tests-install],
+ [AS_HELP_STRING([--enable-tests-install],[install libcgroup tests [default=no]])],
+ [
+ if test "x$enableval" == xno; then
+ with_tests_install=false
+ else
+ with_tests_install=true
+ fi
+ ],
+ [with_tests_install=false])
+AM_CONDITIONAL([WITH_TESTS_INSTALL], [test x$with_tests_install = xtrue])
diff --git a/gunit/Makefile.am b/gunit/Makefile.am
index ba91039..5ba5c28 100644
--- a/gunit/Makefile.am
+++ b/gunit/Makefile.am
@@ -46,5 +46,16 @@ gtest_SOURCES = gtest.cpp \
gtest_LDFLAGS = -L$(top_srcdir)/googletest/googletest -l:libgtest.so \
-rpath $(abs_top_srcdir)/googletest/googletest
+if WITH_TESTS_INSTALL
+noinst_PROGRAMS = gtest
+TESTS_INSTALL_DIR=$(DESTDIR)/$(libdir)/libcgroup/tests
+gtest_LDFLAGS += -rpath $(TESTS_INSTALL_DIR)
+
+install-exec-hook:
+ mkdir -p $(TESTS_INSTALL_DIR)
+ cp -f .libs/gtests $(TESTS_INSTALL_DIR)
+ cp -f $(top_srcdir)/googletest/googletest/libgtest.so $(TESTS_INSTALL_DIR)
+endif
+
clean-local:
${RM} test-procpidcgroup
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
|
@rossburton Thanks for taking a look. Have a nice vacation. |
|
@rossburton, thoughts on this pull request? |
|
Very late reply, sorry. automake's |
Add support for installing testcases, so that the users can run it later
after installation too. The installcheck hook is part of GNU automake
and under the hook, gtest binary gets build and copied over to
$(libdir)/libcgroup/tests/, along with its dependent library
googletest/libgtest.so.
Currently, the gtest is built/run with make check. While building it
uses -rpath to link with /googletest/../libgtest.so.
Just copying over the binary/library might fail to run, if the libcgroup
sources are removed, to address this issue an extra -rpath of install
the destination is pre-pended during linking.
Fixes: libcgroup/libcgroup#60
Suggested-by: Ross Burton ross.burton@arm.com
Signed-off-by: Kamalesh Babulal kamalesh.babulal@oracle.com