summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2018-01-26 17:44:26 +0300
committerAndrei Belov <defan@nginx.com>2018-01-26 17:44:26 +0300
commit9d1410a0bb0ebe792eb3e26ac757dd78847b705e (patch)
tree2c8da8379d100349361748797a3741fe1343fdbb /pkg
parent7fe8f72364fbac68cd82abf8fc775cce965a4a1e (diff)
downloadunit-9d1410a0bb0ebe792eb3e26ac757dd78847b705e.tar.gz
unit-9d1410a0bb0ebe792eb3e26ac757dd78847b705e.tar.bz2
Packages: "test" and "test-debug" targets for rpm.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/rpm/Makefile24
-rw-r--r--pkg/rpm/unit.module.spec.in6
-rw-r--r--pkg/rpm/unit.spec.in2
3 files changed, 28 insertions, 4 deletions
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile
index a5d463c9..03fa1574 100644
--- a/pkg/rpm/Makefile
+++ b/pkg/rpm/Makefile
@@ -50,7 +50,7 @@ CONFIGURE_ARGS=\
export CR=\\n
default:
- @echo "valid targets: all modules unit $(addprefix unit-, $(MODULES)) rpmlint specs clean"
+ @echo "valid targets: all modules unit $(addprefix unit-, $(MODULES)) rpmlint specs test test-debug clean"
all: check-build-depends unit modules
@@ -172,11 +172,31 @@ unit-%: check-build-depends-% rpmbuild/SPECS/unit-%.spec rpmbuild/SOURCES/unit-$
rpmbuild -D "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/$@.spec && \
ln -s rpmbuild/BUILD/$@-$(VERSION)/build $@
+test: unit modules
+ @{ \
+ for so in `find rpmbuild/BUILD/*/build-nodebug/ -type f -name "*.so"`; do \
+ soname=`basename $${so}` ; \
+ test -h rpmbuild/BUILD/unit-$(VERSION)/build-nodebug/$${soname} || \
+ ln -fs `pwd`/$${so} rpmbuild/BUILD/unit-$(VERSION)/build-nodebug/$${soname} ; \
+ done ; \
+ ( cd rpmbuild/BUILD/unit-$(VERSION) && rm -f build && ln -s build-nodebug build && ./test/run.py ) ; \
+ }
+
+test-debug: unit modules
+ @{ \
+ for so in `find rpmbuild/BUILD/*/build-debug/ -type f -name "*.so"`; do \
+ soname=`basename $${so}` ; \
+ test -h rpmbuild/BUILD/unit-$(VERSION)/build-debug/$${soname} || \
+ ln -fs `pwd`/$${so} rpmbuild/BUILD/unit-$(VERSION)/build-debug/$${soname} ; \
+ done ; \
+ ( cd rpmbuild/BUILD/unit-$(VERSION) && rm -f build && ln -s build-debug build && ./test/run.py ) ; \
+ }
+
clean:
rm -rf rpmbuild/SPECS rpmbuild/BUILD rpmbuild/BUILDROOT rpmbuild/RPMS rpmbuild/SRPMS ../../build
rm -f rpmbuild/SOURCES/unit-*.tar.gz unit
find . -maxdepth 1 -type l -delete
-.PHONY: default all modules specs check-build-depends rpmlint clean
+.PHONY: default all modules specs check-build-depends rpmlint test test-debug clean
.SECONDARY:
diff --git a/pkg/rpm/unit.module.spec.in b/pkg/rpm/unit.module.spec.in
index c222a0f1..03d4addb 100644
--- a/pkg/rpm/unit.module.spec.in
+++ b/pkg/rpm/unit.module.spec.in
@@ -63,6 +63,7 @@ make %%MODULE_MAKEARGS%%
--cc-opt="%{CC_OPT}"
./configure %%MODULE_CONFARGS%%
make %%MODULE_MAKEARGS%%
+%{__mv} build build-nodebug
%install
%{__rm} -rf %{buildroot}
@@ -70,9 +71,10 @@ make %%MODULE_MAKEARGS%%
%{__install} -m 644 -p NOTICE \
%{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT
%%MODULE_PREINSTALL%%
+%{__ln_s} build-debug build
DESTDIR=%{buildroot} make %%MODULE_INSTARGS%%
-%{__rm} -rf build
-%{__mv} build-debug build
+%{__rm} -f build
+%{__ln_s} build-nodebug build
DESTDIR=%{buildroot} make %%MODULE_INSTARGS%%
%check
diff --git a/pkg/rpm/unit.spec.in b/pkg/rpm/unit.spec.in
index e44c3952..b510d069 100644
--- a/pkg/rpm/unit.spec.in
+++ b/pkg/rpm/unit.spec.in
@@ -77,9 +77,11 @@ dynamically via an API.
--cc-opt="%{CC_OPT}" \
--ld-opt="%{LD_OPT}"
%{__make} %{?_smp_mflags}
+%{__mv} build build-nodebug
%install
%{__rm} -rf %{buildroot}
+%{__ln_s} build-nodebug build
DESTDIR=%{buildroot} make unitd-install
%{__install} -m755 %{bdir}/build-debug/unitd \
%{buildroot}%{_sbindir}/unitd-debug