You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/04/19 07:45:17 UTC

[trafficserver] branch master updated: Update TSQA bootstrap target.

This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  17ecac0   Update TSQA bootstrap target.
17ecac0 is described below

commit 17ecac0a698e0080c2f7bd921d6b69e88f2152fe
Author: James Peach <jp...@apache.org>
AuthorDate: Mon Apr 18 22:42:07 2016 -0700

    Update TSQA bootstrap target.
    
    Update the TSQA bootstrap target so that it tries to install the
    right packages for the running distribution. Tested on Fedora23
    only, but this should be a no-op on other distributions.
    
    Add a trivial wrapper around nosetests to make it easier to explore
    how nose runs tests.
---
 ci/tsqa/Makefile  | 46 +++++++++++++++++++++++++++++++++++++++++-----
 ci/tsqa/nosetests | 30 ++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/ci/tsqa/Makefile b/ci/tsqa/Makefile
index 6b58359..58ebef2 100644
--- a/ci/tsqa/Makefile
+++ b/ci/tsqa/Makefile
@@ -16,17 +16,48 @@
 
 .PHONY: test list clean update bootstrap
 
-VIRTUALENV_DIR = virtualenv
+-include /etc/os-release
+DISTRIBUTION := $(NAME)$(VERSION_ID)
+
+# Search for a program in $PATH (direct from the GNU make manual.
+pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
+
+APT := $(call pathsearch,apt-get)
+DNF := $(call pathsearch,dnf)
+YUM := $(call pathsearch,yum)
+
+ifndef DISTRIBUTION
+ifneq ($(APT),)
+DISTRIBUTION := DebianGeneric
+else ifneq ($(DNF),)
+DISTRIBUTION := RedHatGeneric
+else ifneq ($(YUM),)
+DISTRIBUTION := RedHatGeneric
+endif
+endif
+
+PACKAGES_Fedora23 := python-pip python-virtualenv python-devel libffi-devel redhat-rpm-config
+PACKAGES_RedHatGeneric := python-pip python-virtualenv python-devel libcffi-devel
+PACKAGES_DebianGeneric := python-pip python-virtualenv python-dev libffi-dev
+
+PACKAGES := $(PACKAGES_$(DISTRIBUTION))
+
+VIRTUALENV_DIR := virtualenv
+
+NOSETESTS := ./nosetests
 
 # Run all tests.
+.PHONY: test
 test: $(VIRTUALENV_DIR)
-	@. $(VIRTUALENV_DIR)/bin/activate && $(VIRTUALENV_DIR)/bin/nosetests --with-xunit -sv --logging-level=INFO
+	@$(NOSETESTS) --with-xunit --nocapture --verbose --logging-level=INFO
 
 # Scan and list the tests.
+.PHONY: list
 list: $(VIRTUALENV_DIR)
-	@. $(VIRTUALENV_DIR)/bin/activate && $(VIRTUALENV_DIR)/bin/nosetests -sv --collect-only
+	@$(NOSETESTS) -sv --collect-only
 
 # Construct the virtualenv.
+.PHONY: $(VIRTUALENV_DIR)
 $(VIRTUALENV_DIR): $(VIRTUALENV_DIR)/.done
 
 $(VIRTUALENV_DIR)/.done:
@@ -37,20 +68,25 @@ $(VIRTUALENV_DIR)/.done:
 	@echo "Virtualenv ready!"
 
 # Update the virtualenv with the latest TSQA package and dependencies.
+.PHONY: update
 update:
 	@rm -f $(VIRTUALENV_DIR)/.done
 	@. $(VIRTUALENV_DIR)/bin/activate && \
+		$(VIRTUALENV_DIR)/bin/pip install --upgrade pip && \
 		$(VIRTUALENV_DIR)/bin/pip install --upgrade -r requirements.txt && \
 		touch $(VIRTUALENV_DIR)/.done
 
 # Install TSQA bootstrap dependencies.
+.PHONY: bootstrap
 bootstrap:
+	@echo package list is $(PACKAGES)
 	@if [ -e /etc/debian_version ]; then \
-		apt-get install -y python-pip python-virtualenv python-dev libffi-dev ; \
+		$(APT) install -y $(PACKAGES) ; \
 	fi
 	@if [ -e /etc/redhat-release ]; then \
-		yum install -y python-pip python-virtualenv python-devel libcffi-devel ; \
+		$(YUM) install -y $(PACKAGES) ; \
 	fi
 
+.PHONY: clean
 clean:
 	rm -rf virtualenv
diff --git a/ci/tsqa/nosetests b/ci/tsqa/nosetests
new file mode 100755
index 0000000..7486f4d
--- /dev/null
+++ b/ci/tsqa/nosetests
@@ -0,0 +1,30 @@
+#! /usr/bin/env bash
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+set -e # exit on error
+
+TSQA=$(cd $(dirname $0); pwd)
+
+cd $TSQA
+
+. ./virtualenv/bin/activate
+
+./virtualenv/bin/nosetests \
+        --with-xunit \
+        --nocapture \
+	"$@"

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].