Update bootstrap
[m6w6/libmemcached] / bootstrap.sh
index 4e2a078e50b65c6d7162caf131f08d90640c9b63..cd8c5d12dd8c78267edffae2b266a124022da944 100755 (executable)
@@ -388,8 +388,7 @@ function run_configure ()
   # Set ENV ASSERT in order to enable assert.
   # If we are doing a valgrind run, we always compile with assert disabled
   if $valgrind_run; then
-    BUILD_CONFIGURE_ARG+= " CXXFLAGS=-DNDEBUG "
-    BUILD_CONFIGURE_ARG+= " CFLAGS=-DNDEBUG "
+    BUILD_CONFIGURE_ARG+= '--enable-assert=no'
   else
     if $DEBUG; then 
       BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert'
@@ -447,7 +446,7 @@ function setup_gdb_command () {
 function setup_valgrind_command () {
   VALGRIND_PROGRAM=`type -p valgrind`
   if [[ -n "$VALGRIND_PROGRAM" ]]; then
-    VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --malloc-fill=A5 --free-fill=DE --xml=yes --xml-file=\"valgrind-%p.xml\""
+    VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --malloc-fill=A5 --free-fill=DE --xml=yes --xml-file=\"valgrind-%p.xml\" --gen-suppressions=yes --log-file=\"valgrind-%p.txt\""
   fi
 }
 
@@ -573,12 +572,13 @@ function make_valgrind ()
 
   # If we don't have a configure, then most likely we will be missing libtool
   assert_file 'configure'
-  if [[ -f 'libtool' ]]; then
+  if [[ -x 'libtool' ]]; then
     TESTS_ENVIRONMENT="./libtool --mode=execute $VALGRIND_COMMAND"
   else
     TESTS_ENVIRONMENT="$VALGRIND_COMMAND"
   fi
 
+  make_target 'all'
   make_target 'check'
   ret=$?
 
@@ -653,7 +653,7 @@ function make_for_snapshot ()
   assert_no_directory 'autom4te.cache'
 
   run_configure
-  make_target 'dist'
+  make_target 'all'
   make_target 'distclean'
 
   # We should have a configure, but no Makefile at the end of this exercise
@@ -856,6 +856,13 @@ function make_universe ()
   make_install_system
 }
 
+function check_snapshot ()
+{
+  if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
+    assert_file "$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed'
+  fi
+}
+
 function make_for_continuus_integration ()
 {
   # Setup the environment if we are local
@@ -871,9 +878,7 @@ function make_for_continuus_integration ()
       assert_file 'configure'
     fi
 
-    if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
-      assert_file "$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed'
-    fi
+    check_snapshot
   else
     # If we didn't require a snapshot, then we should not have a configure
     assert_no_file 'configure'
@@ -890,41 +895,15 @@ function make_for_continuus_integration ()
       assert_exec_file 'configure'
       assert_file 'Makefile'
 
+      make_target 'all'
+
       # make rpm includes "make distcheck"
       if [[ -f rpm.am ]]; then
-        make_target 'all'
         make_rpm
       elif [[ -d rpm ]]; then
-        make_target 'all'
         make_rpm
-      else
-        make_distcheck
       fi
       ;;
-    *-precise-*)
-      run_configure
-
-      assert_exec_file 'configure'
-      assert_file 'Makefile'
-
-      make_distcheck
-      ;;
-    *-quantal-*)
-      run_configure
-
-      assert_exec_file 'configure'
-      assert_file 'Makefile'
-
-      make_distcheck
-      ;;
-    *-raring-*)
-      run_configure
-
-      assert_exec_file 'configure'
-      assert_file 'Makefile'
-
-      make_distcheck
-      ;;
     *)
       make_jenkins_default
       ;;
@@ -1636,6 +1615,7 @@ function bootstrap ()
       'snapshot')
         make_for_snapshot
         snapshot_run=true
+        check_snapshot
         ;;
       'rpm')
         make_rpm
@@ -1739,6 +1719,12 @@ function main ()
           MAKE_TARGET="$label"
         fi
       fi
+      if [[ -n "$LABEL" ]]; then
+        check_make_target $LABEL
+        if [ $? -eq 0 ]; then
+          MAKE_TARGET="$LABEL"
+        fi
+      fi
 
       if [ -z "$MAKE_TARGET" ]; then
         MAKE_TARGET='jenkins'