Permalink
Browse files

Add a Thrift stable integration test case.

This new test case tests the merge process for thrift4go into the
latest Thrift stable release (presently 0.8.0).  It does not perform
any end-to-end runnings of the tools but rather just verifies that the
generator C++ code as well as the autotools infrastructure are correct.
  • Loading branch information...
1 parent d8488da commit 666dd84226fb7e80d12d3bec9a7027f20bb6f48d @matttproud matttproud committed Aug 13, 2012
Showing with 251 additions and 4 deletions.
  1. +1 −1 Makefile
  2. +2 −2 lib/go/Makefile
  3. +46 −0 scripts/bootstrap.sh
  4. +89 −0 scripts/cleanup.sh
  5. +38 −1 { → scripts}/merge_and_build.sh
  6. +17 −0 tests/Makefile
  7. +7 −0 tests/README
  8. +48 −0 tests/merge/Makefile
  9. +3 −0 tests/merge/README
View
@@ -1,4 +1,4 @@
-SUB_DIRECTORIES = lib
+SUB_DIRECTORIES = lib tests
CLEAN_DIRECTORIES = $(SUB_DIRECTORIES:%=clean-%)
TEST_DIRECTORIES = $(SUB_DIRECTORIES:%=test-%)
View
@@ -1,5 +1,5 @@
export GOPATH = $(CURDIR)
-ARTIFACTS = test-stamp
+TEST_ARTIFACTS = test-stamp
all: test
@@ -11,6 +11,6 @@ test-stamp:
touch $@
clean:
- -rm -f $(ARTIFACTS)
+ -rm -f $(TEST_ARTIFACTS)
.PHONY: test clean
View
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+#
+# 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.
+#
+
+./cleanup.sh
+if test -d lib/php/src/ext/thrift_protocol ; then
+ if phpize -v >/dev/null 2>/dev/null ; then
+ (cd lib/php/src/ext/thrift_protocol && phpize)
+ fi
+fi
+
+set -e
+
+# libtoolize is called "glibtoolize" on OSX.
+if libtoolize --version 1 >/dev/null 2>/dev/null; then
+ LIBTOOLIZE=libtoolize
+elif glibtoolize --version 1 >/dev/null 2>/dev/null; then
+ LIBTOOLIZE=glibtoolize
+else
+ echo >&2 "Couldn't find libtoolize!"
+ exit 1
+fi
+
+autoscan
+$LIBTOOLIZE --copy --automake
+aclocal -I ./aclocal
+autoheader
+autoconf
+automake --copy --add-missing --foreign
View
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+#
+# 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.
+#
+
+topsrcdir="`dirname $0`"
+cd "$topsrcdir"
+
+make -k clean >/dev/null 2>&1
+make -k distclean >/dev/null 2>&1
+find . -name Makefile.in -exec rm -f {} \;
+rm -rf \
+AUTHORS \
+ChangeLog \
+INSTALL \
+Makefile \
+Makefile.in \
+Makefile.orig \
+aclocal/libtool.m4 \
+aclocal/ltoptions.m4 \
+aclocal/ltsugar.m4 \
+aclocal/ltversion.m4 \
+aclocal/lt~obsolete.m4 \
+aclocal.m4 \
+autom4te.cache \
+autoscan.log \
+config.guess \
+config.h \
+config.hin \
+config.hin~ \
+config.log \
+config.status \
+config.status.lineno \
+config.sub \
+configure \
+configure.lineno \
+configure.scan \
+depcomp \
+.deps \
+install-sh \
+.libs \
+libtool \
+ltmain.sh \
+missing \
+ylwrap \
+if/gen-* \
+test/gen-* \
+lib/php/src/ext/thrift_protocol/.deps \
+lib/php/src/ext/thrift_protocol/Makefile \
+lib/php/src/ext/thrift_protocol/Makefile.fragments \
+lib/php/src/ext/thrift_protocol/Makefile.global \
+lib/php/src/ext/thrift_protocol/Makefile.objects \
+lib/php/src/ext/thrift_protocol/acinclude.m4 \
+lib/php/src/ext/thrift_protocol/aclocal.m4 \
+lib/php/src/ext/thrift_protocol/autom4te.cache \
+lib/php/src/ext/thrift_protocol/build \
+lib/php/src/ext/thrift_protocol/config.guess \
+lib/php/src/ext/thrift_protocol/config.h \
+lib/php/src/ext/thrift_protocol/config.h.in \
+lib/php/src/ext/thrift_protocol/config.log \
+lib/php/src/ext/thrift_protocol/config.nice \
+lib/php/src/ext/thrift_protocol/config.status \
+lib/php/src/ext/thrift_protocol/config.sub \
+lib/php/src/ext/thrift_protocol/configure \
+lib/php/src/ext/thrift_protocol/configure.in \
+lib/php/src/ext/thrift_protocol/include \
+lib/php/src/ext/thrift_protocol/install-sh \
+lib/php/src/ext/thrift_protocol/libtool \
+lib/php/src/ext/thrift_protocol/ltmain.sh \
+lib/php/src/ext/thrift_protocol/missing \
+lib/php/src/ext/thrift_protocol/mkinstalldirs \
+lib/php/src/ext/thrift_protocol/modules \
+lib/php/src/ext/thrift_protocol/run-tests.php
@@ -8,15 +8,36 @@ checks will be run before-hand.
One may wish to run this script as "bash -x ${0}" to see exactly what steps
it performs, as it will modify the local source copy of Thrift. The script
will abort if it encounters any errors.
+
+It may also be run as "${0} -b" for batch mode, in which case no prompts will
+be performed.
EOF
+batch=false
+
+arguments=$(getopt b ${*})
+set -- ${arguments}
+
+for i do
+ case "${i}" in
+ -b)
+ batch=true
+ shift;;
+ --)
+ shift
+ break;;
+ esac
+done
+
+if [[ "${batch}" == "false" ]]; then
while true ; do
read -p "Do you wish to proceed: [Y]es or [N]o?" response
case "${response}" in
[Yy]* ) break ;;
[Nn]* ) echo "Aborting..." ; exit 1 ;;
esac
done
+fi
if [ ! -d "${THRIFT}" ]; then
cat >&2 <<EOF
@@ -32,14 +53,30 @@ fi
if [ ! -d "${THRIFT4GO}" ]; then
cat >&2 <<EOF
A required environmental variable was not set: "THRIFT4GO". This should refer
-to the path where a pristine copy of thrift4g0 lives.
+to the path where a pristine copy of thrift4go lives.
export THRIFT4GO='/tmp/thrift4go
EOF
exit 1
fi
+if [ ! -x "${THRIFT}/cleanup.sh" ]; then
+cat >&2 <<EOF
+WARNING: ${THRIFT}/cleanup.sh does not exist. A copy from Thrift 0.8.0 is
+being provided in its place. This may occur if using a Thrift release tarball.
+EOF
+cp -f "${THRIFT4GO}/scripts/cleanup.sh" "${THRIFT}/cleanup.sh"
+fi
+
+if [ ! -x "${THRIFT}/bootstrap.sh" ]; then
+cat >&2 <<EOF
+WARNING: ${THRIFT}/bootstrap.sh does not exist. A copy from Thrift 0.8.0 is
+being provided in its place. This may occur if using a Thrift release tarball.
+EOF
+cp -f "${THRIFT4GO}/scripts/bootstrap.sh" "${THRIFT}/bootstrap.sh"
+fi
+
set -e
rm -rf "${THRIFT}/lib/go"
View
@@ -0,0 +1,17 @@
+SUB_DIRECTORIES = merge
+CLEAN_DIRECTORIES = $(SUB_DIRECTORIES:%=clean-%)
+TEST_DIRECTORIES = $(SUB_DIRECTORIES:%=test-%)
+
+all: test
+
+test: $(TEST_DIRECTORIES)
+
+$(TEST_DIRECTORIES):
+ $(MAKE) -C $(@:test-%=%) test
+
+clean: $(CLEAN_DIRECTORIES)
+
+$(CLEAN_DIRECTORIES):
+ $(MAKE) -C $(@:clean-%=%) clean
+
+.PHONY: test $(TEST_DIRECTORIES) $(CLEAN_DIRECTORIES)
View
@@ -0,0 +1,7 @@
+This directory contains test cases for thrift4go. Each test case should exist
+in its own directory with a Makefile that properly handles the two cases:
+
+- clean: Destroy any test artifacts and return the environment to a pristine
+ condition.
+
+- test: Setup the test environment and run the tests.
View
@@ -0,0 +1,48 @@
+THRIFT_ARCHIVE_URL = https://dist.apache.org/repos/dist/release/thrift/0.8.0/thrift-0.8.0.tar.gz
+TEST_ARTIFACTS = \
+ test-merge-stamp \
+ test-stamp \
+ thrift-0.8.0 \
+ thrift-0.8.0.tar.gz \
+ thrift-extraction-stamp \
+ tree \
+ tree-stamp
+
+export THRIFT=$(CURDIR)/thrift-0.8.0
+export THRIFT4GO=$(CURDIR)/../..
+
+all: test
+
+test: test-stamp
+
+test-stamp: test-merge
+ touch $@
+
+test-merge: test-merge-stamp
+
+test-merge-stamp: thrift-extraction tree-stamp
+ cd $(THRIFT4GO) && bash ./scripts/merge_and_build.sh -b
+ cd $(THRIFT) && ./configure \
+ --prefix=$(CURDIR)/tree \
+ --with-go \
+ --without-{c_glib,java,haskell,php,erlang,perl,python,ruby}
+ cd $(THRIFT) && make
+ touch $@
+
+tree-stamp:
+ mkdir -vp tree
+ touch $@
+
+thrift-extraction: thrift-extraction-stamp
+
+thrift-0.8.0.tar.gz:
+ wget https://dist.apache.org/repos/dist/release/thrift/0.8.0/thrift-0.8.0.tar.gz
+
+thrift-extraction-stamp: thrift-0.8.0.tar.gz
+ tar xzvf thrift-0.8.0.tar.gz
+ touch $@
+
+clean:
+ rm -rf $(TEST_ARTIFACTS)
+
+.PHONY: test test-merge thrift-extraction
View
@@ -0,0 +1,3 @@
+This test case is designed to test the integration of thrift4go into the Thrift
+stable release (presently 0.8.0). Specifically, this purely verifies that it
+can be merged and that the resultant Thrift package can be compiled.

0 comments on commit 666dd84

Please sign in to comment.