]> git.gsnw.org Git - fping.git/commitdiff
travis-ci improvements, add macos testing
authorDavid Schweikert <david@schweikert.ch>
Mon, 3 Aug 2020 05:48:45 +0000 (07:48 +0200)
committerDavid Schweikert <david@schweikert.ch>
Mon, 3 Aug 2020 19:18:49 +0000 (22:18 +0300)
12 files changed:
.travis.yml
ci/build-1-autotools.sh
ci/build-2-test-command.sh [new file with mode: 0755]
ci/build-3-prepare-macos.sh [moved from ci/prepare-macos.sh with 100% similarity]
ci/build-4-compile.sh [moved from ci/build-2-install.sh with 100% similarity]
ci/coveralls.sh [deleted file]
ci/deploy-bintray.sh
ci/deploy-coveralls.sh [new file with mode: 0755]
ci/run-tests.sh [new file with mode: 0755]
ci/test-11-nopriv-fail.pl [moved from ci/test-11-nopriv.pl with 100% similarity]
ci/test-tarball.sh
src/fping.c

index d0b773cc99cb3b18ae16803679d1402f5500ad84..669acd1309c774944f9e5fcdb2ed29398908cfe2 100644 (file)
@@ -1,40 +1,73 @@
-# travis-ci.org configuration
-# 
 language: generic
-sudo: required
-dist: trusty
+
+os:
+  - linux
+
+dist:
+  - trusty
+  - xenial
+
 env:
-    global:
-        - secure: "CoI8hwHH1yfQoQxIfWGRS0WfTyScox+5aJn0fDDgz2uKrrIxmBvIw/WKX8wcSiV6fLmLuwgNkKqSM3hdO4qaG+JxfWcuEiZZHm+kxSGMkWbGb/fvAI+gHg8ldKyYttcIX71O5rlZiC2QpNKQi2v18S6pI5p8eqnx7DYx4YrmguQ="
-       # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
-       #   via the "travis encrypt" command using the project repo's public key
-        - secure: "C9ZJ9LYnuowRdF4D66KLfquimvu8GtRGIafwvCcGYKReEy8phlBdFsHlybkMBNYJNTJSM0j6wyo1lKTVGHxmpQDimjR7kmxUtawbhuJ5qOCBtFqNVh9lRQi7hC4+UOhvRsIcbV8HAJM5u/5RxGOfXCePK3a2DtiYv1d2NHToZN8="
+  global:
+    - secure: "CoI8hwHH1yfQoQxIfWGRS0WfTyScox+5aJn0fDDgz2uKrrIxmBvIw/WKX8wcSiV6fLmLuwgNkKqSM3hdO4qaG+JxfWcuEiZZHm+kxSGMkWbGb/fvAI+gHg8ldKyYttcIX71O5rlZiC2QpNKQi2v18S6pI5p8eqnx7DYx4YrmguQ="
+     # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
+     #   via the "travis encrypt" command using the project repo's public key
+    - secure: "C9ZJ9LYnuowRdF4D66KLfquimvu8GtRGIafwvCcGYKReEy8phlBdFsHlybkMBNYJNTJSM0j6wyo1lKTVGHxmpQDimjR7kmxUtawbhuJ5qOCBtFqNVh9lRQi7hC4+UOhvRsIcbV8HAJM5u/5RxGOfXCePK3a2DtiYv1d2NHToZN8="
+
 compiler:
-    - gcc
-before_install:
-    - sudo apt-get update -qq
-    - sudo apt-get install libcap2-bin
-    #- sudo apt-get install traceroute
-    #- traceroute google.com
-    - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
-install:
-    - ci/build-1-autotools.sh
-    - curl -L http://cpanmin.us | perl - --sudo App::cpanminus
-    - cpanm --sudo Test::Command
-script:
-    - ci/build-2-install.sh
-    - env PATH=`pwd`/src:$PATH prove ci/test-*.pl
-    - ci/test-tarball.sh
-after_success:
-    - ci/coveralls.sh
-    - ci/deploy-bintray.sh
+  - gcc
 
 addons:
+  apt:
+    update: true
+    packages:
+      - libcap2-bin
+      - libtest-command-perl
   coverity_scan:
     project:
       name: "schweikert/fping"
       description: "Build submitted via Travis CI"
     notification_email: david@schweikert.ch
-    #build_command_prepend: "ci/build-2-install.sh"
-    build_command:   "ci/build-2-install.sh"
+    build_command:   "ci/build-3-compile.sh"
     branch_pattern: coverity_scan
+    
+install:
+  - ci/build-1-autotools.sh
+  - ci/build-2-test-command.sh
+  - ci/build-3-prepare-macos.sh
+
+script:
+  - ci/build-4-compile.sh
+  - ci/run-tests.sh
+  - ci/deploy-bintray.sh
+
+after_success:
+  - ci/deploy-coveralls.sh
+
+stages:
+  - test
+  - name: deploy
+    if: branch = master OR branch = v4.x
+
+jobs:
+  include:
+    #### STAGE: test
+    - stage: test
+      name: test trusty
+      os: linux
+      dist: trusty
+
+    - name: test xenial
+      os: linux
+      dist: xenial
+
+    - name: test macos
+      os: osx
+
+    #### STAGE: deploy
+    - stage: deploy
+      name: deploy
+      os: linux
+      dist: xenial
+      env:
+        - DO_DEPLOY=1
index 0e05c137e38906388e6cd9dcecbf86f6749121f1..a272f59e3ae316984662df211f4e552faa158d14 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/bash -e
 
+if [[ "$OSTYPE" == "darwin"* ]]; then
+    exit 0
+fi
+
 AUTOCONF=http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
 AUTOMAKE=http://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.gz
 LIBTOOL=http://alpha.gnu.org/gnu/libtool/libtool-2.4.2.418.tar.gz
diff --git a/ci/build-2-test-command.sh b/ci/build-2-test-command.sh
new file mode 100755 (executable)
index 0000000..5e5637c
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -ex
+
+curl -L http://cpanmin.us | perl - --sudo App::cpanminus
+cpanm --sudo Test::Command
+
similarity index 100%
rename from ci/build-2-install.sh
rename to ci/build-4-compile.sh
diff --git a/ci/coveralls.sh b/ci/coveralls.sh
deleted file mode 100755 (executable)
index f7de299..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-set -x
-
-sudo -H pip install cpp-coveralls
-
-cd src
-
-ls -l
-
-gcov *.o
-cd ..
-coveralls --exclude ci --exclude src/optparse.c --no-gcov
index 95219a30e8917391359c6ae7fb887802586e388b..a234f2cdf233a284b2c8a4cdba098c3f2061399d 100755 (executable)
@@ -4,15 +4,8 @@
 
 set -e
 
-# do this only for the gcc run
-#if [ "$CC" != "gcc" ]; then
-#    echo "skipped upload because $CC != gcc"
-#    exit 0
-#fi
-
-# do this only for the master and version3 branch
-if [ "$TRAVIS_BRANCH" != "master" -a "$TRAVIS_BRANCH" != "version3" ]; then
-    echo "skipped upload branch $TRAVIS_BRANCH isn't master/version3"
+if [ -z "$DO_DEPLOY" ]; then
+    echo "skip deploy (\$DO_DEPLOY not set)"
     exit 0
 fi
 
diff --git a/ci/deploy-coveralls.sh b/ci/deploy-coveralls.sh
new file mode 100755 (executable)
index 0000000..1396015
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -xe
+
+pip install --user cpp-coveralls
+coveralls --root src --exclude src/optparse.c --gcov-options '\-lp'
diff --git a/ci/run-tests.sh b/ci/run-tests.sh
new file mode 100755 (executable)
index 0000000..9d5a308
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -ex
+
+PATH=`pwd`/src:$PATH
+
+prove ci/test-*.pl
+ci/test-tarball.sh
index 48d0567b9225809cd80839fff9459f23d00adc62..da43a25727932a81ce3c9453e1588374cf311302 100755 (executable)
@@ -6,6 +6,11 @@
 set -e
 set -x
 
+# skip on macos
+if [[ "$OSTYPE" == "darwin"* ]]; then
+    exit 0
+fi
+
 make dist
 VERSION=$(ls fping-*.tar.gz | sed -e 's/^fping-//' | sed -e 's/\.tar\.gz$//')
 if [ -z "$VERSION" ]; then
index 0b8d780db1df469d4cd6d03c4bf123292ccccb06..f4d0d84a63dcf62b8b3a7d693c6fbe431cc0ae98 100644 (file)
@@ -373,7 +373,7 @@ void errno_crash_and_burn(char* message);
 char* get_host_by_address(struct in_addr in);
 int send_ping(HOST_ENTRY* h, int index);
 void usage(int);
-int wait_for_reply(long);
+int wait_for_reply(int64_t);
 void print_per_system_stats(void);
 void print_per_system_splits(void);
 void print_netdata(void);
@@ -1273,7 +1273,7 @@ void main_loop()
 
             if (per_recv_flag) {
                 if (timestamp_flag) {
-                    printf("[%10.5f] ", (double)current_time_ns / 1e9);
+                    printf("[%.5f] ", (double)current_time_ns / 1e9);
                 }
                 printf("%-*s : [%d], timed out",
                     max_hostname_len, h->host, event->ping_index);
@@ -2384,7 +2384,7 @@ int wait_for_reply(int64_t wait_time)
     /* print received ping (unless --quiet) */
     if (per_recv_flag) {
         if (timestamp_flag) {
-            printf("[%10.5f] ", (double)recv_time / 1e9);
+            printf("[%.5f] ", (double)recv_time / 1e9);
         }
         avg = h->total_time / h->num_recv;
         printf("%-*s : [%d], %d bytes, %s ms",