Compare commits
3 Commits
develop
...
json-outpu
Author | SHA1 | Date |
---|---|---|
David Schweikert | bfe7296c60 | 5 years ago |
Fabian Bonk | 3923fa5185 | 5 years ago |
Fabian Bonk | b871e4d6ce | 5 years ago |
@ -1,30 +0,0 @@
|
||||
.*.swp
|
||||
*.tar.gz
|
||||
*~
|
||||
src/*.gcno
|
||||
src/*.gcda
|
||||
src/*.gcov
|
||||
src/tags
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
missing
|
||||
src/*.o
|
||||
src/fping
|
||||
src/fping6
|
||||
stamp-h1
|
||||
doc/fping.8
|
||||
doc/fping6.8
|
||||
ci/build
|
@ -1,108 +0,0 @@
|
||||
name: Test
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
Test-Linux:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04, ubuntu-22.04]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install libcap2-bin libtest-command-perl lcov
|
||||
sudo sysctl net.ipv4.ping_group_range='0 2147483647'
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
ci/build-1-autotools.sh
|
||||
ci/build-4-compile.sh
|
||||
ci/test-tarball.sh
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
set -ex
|
||||
PATH=`pwd`/src:$PATH
|
||||
# avoid pinging internet hosts because it doesn't
|
||||
# work with GitHub Actions being hosted in Azure.
|
||||
prove $(ls ci/test-*.pl|grep -v internet-hosts)
|
||||
ci/run-lcov.sh
|
||||
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
path-to-lcov: lcov.info
|
||||
flag-name: ${{ matrix.os }}
|
||||
parallel: true
|
||||
|
||||
|
||||
|
||||
Test-Mac:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install automake lcov
|
||||
ci/build-2-test-command.sh
|
||||
ci/build-3-prepare-macos.sh
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
ci/build-4-compile.sh
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
set -ex
|
||||
PATH=`pwd`/src:$PATH
|
||||
export SKIP_IPV6=1
|
||||
prove $(ls ci/test-*.pl|grep -v internet-hosts)
|
||||
ci/run-lcov.sh
|
||||
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
path-to-lcov: lcov.info
|
||||
flag-name: macos
|
||||
parallel: true
|
||||
|
||||
Coveralls-Finish:
|
||||
needs: [Test-Linux, Test-Mac]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
parallel-finished: true
|
||||
|
||||
Release-Tarball:
|
||||
needs: [Test-Linux, Test-Mac]
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install libcap2-bin libtest-command-perl
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
ci/build-1-autotools.sh
|
||||
ci/build-4-compile.sh
|
||||
ci/test-tarball.sh
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dist
|
||||
path: fping-*.tar.gz
|
@ -1,98 +1,40 @@
|
||||
# travis-ci.org configuration
|
||||
#
|
||||
language: generic
|
||||
|
||||
os:
|
||||
- linux
|
||||
|
||||
dist:
|
||||
- trusty
|
||||
- xenial
|
||||
|
||||
sudo: required
|
||||
dist: trusty
|
||||
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="
|
||||
|
||||
notifications:
|
||||
webhooks: https://coveralls.io/webhook
|
||||
|
||||
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
|
||||
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- libcap2-bin
|
||||
- libtest-command-perl
|
||||
|
||||
- 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-4-compile.sh
|
||||
- ci/run-tests.sh
|
||||
|
||||
- ci/build-2-install.sh
|
||||
- env PATH=`pwd`/src:$PATH prove ci/test-*.pl
|
||||
- ci/test-tarball.sh
|
||||
after_success:
|
||||
- ci/deploy-coveralls.sh
|
||||
- ci/coveralls.sh
|
||||
- ci/deploy-bintray.sh
|
||||
|
||||
stages:
|
||||
- test
|
||||
- name: deploy
|
||||
if: branch = master OR branch = v4.x
|
||||
- name: coverity
|
||||
if: branch = master OR branch = coverity_scan
|
||||
|
||||
jobs:
|
||||
include:
|
||||
#### STAGE: test
|
||||
- stage: test
|
||||
name: test trusty
|
||||
os: linux
|
||||
dist: trusty
|
||||
env:
|
||||
- SKIP_IPV6=1
|
||||
install:
|
||||
- ci/build-1-autotools.sh
|
||||
|
||||
- name: test xenial
|
||||
os: linux
|
||||
dist: xenial
|
||||
env:
|
||||
- SKIP_IPV6=1
|
||||
|
||||
- name: test bionic
|
||||
os: linux
|
||||
dist: bionic
|
||||
env:
|
||||
- SKIP_IPV6=1
|
||||
|
||||
- name: test bionic lxd arm64
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: arm64
|
||||
|
||||
- name: test macos
|
||||
os: osx
|
||||
install:
|
||||
- ci/build-2-test-command.sh
|
||||
- ci/build-3-prepare-macos.sh
|
||||
env:
|
||||
- SKIP_IPV6=1
|
||||
|
||||
#### STAGE: deploy
|
||||
- stage: deploy
|
||||
name: deploy
|
||||
os: linux
|
||||
dist: xenial
|
||||
env:
|
||||
- SKIP_IPV6=1
|
||||
after_success:
|
||||
- ci/deploy-bintray.sh
|
||||
|
||||
#### STAGE: coverity
|
||||
- stage: coverity
|
||||
name: coverity
|
||||
os: linux
|
||||
dist: xenial
|
||||
after_success:
|
||||
script:
|
||||
- ci/deploy-coverity.sh
|
||||
addons:
|
||||
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"
|
||||
branch_pattern: coverity_scan
|
||||
|
@ -1,35 +0,0 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug fping",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/src/fping",
|
||||
"args": ["127.0.0.1"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Set Disassembly Flavor to Intel",
|
||||
"text": "-gdb-set disassembly-flavor intel",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "build",
|
||||
"postDebugTask": "autoclean",
|
||||
"miDebuggerPath": "/usr/bin/gdb",
|
||||
"logging": {
|
||||
"engineLogging": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "autogen",
|
||||
"command": "./autogen.sh",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "configure",
|
||||
"command": "./configure",
|
||||
"args": ["--enable-debug"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"dependsOn": ["autogen"],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "build",
|
||||
"command": "make",
|
||||
"args": ["CFLAGS=\"-g -O0\""],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"dependsOn": ["configure"],
|
||||
"problemMatcher": ["$gcc"]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "autoclean",
|
||||
"command": "./autoclean.sh",
|
||||
"problemMatcher": []
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
SUBDIRS = doc src
|
||||
|
||||
EXTRA_DIST = CHANGELOG.md contrib README.md ci/*.sh ci/*.pl
|
||||
EXTRA_DIST = CHANGELOG.md
|
||||
|
@ -1,52 +0,0 @@
|
||||
jobs:
|
||||
- job: linux_build
|
||||
displayName: Linux Build
|
||||
|
||||
pool:
|
||||
name: Azure Pipelines
|
||||
vmImage: 'ubuntu-latest'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install libcap2-bin libtest-command-perl
|
||||
displayName: 'before_install'
|
||||
|
||||
- script: |
|
||||
ci/build-4-compile.sh
|
||||
displayName: install
|
||||
|
||||
- script: |
|
||||
set -ex
|
||||
PATH=`pwd`/src:$PATH
|
||||
prove $(ls ci/test-*.pl|grep -v internet-hosts|grep -v -E "test-13-unknown-host.pl|test-14-ping-internet-hosts.pl")
|
||||
ci/test-tarball.sh
|
||||
displayName: 'build_test'
|
||||
|
||||
- job: macos_build
|
||||
displayName: macOS Build
|
||||
|
||||
pool:
|
||||
name: Azure Pipelines
|
||||
vmImage: 'macos-latest'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- script: |
|
||||
brew install autoconf automake lcov
|
||||
ci/build-2-test-command.sh
|
||||
ci/build-3-prepare-macos.sh
|
||||
displayName: 'before_install'
|
||||
|
||||
- script: |
|
||||
ci/build-4-compile.sh
|
||||
displayName: install
|
||||
|
||||
- script: |
|
||||
set -ex
|
||||
PATH=`pwd`/src:$PATH
|
||||
export SKIP_IPV6=1
|
||||
prove $(ls ci/test-*.pl|grep -v internet-hosts|grep -v test-10-option-u-x.pl)
|
||||
ci/run-lcov.sh
|
||||
displayName: 'build_test'
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
curl -L http://cpanmin.us | perl - -L $HOME/perl5 App::cpanminus
|
||||
$HOME/perl5/bin/cpanm --sudo Test::Command
|
@ -0,0 +1,13 @@
|
||||
#!/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
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
|
||||
if [ "$TRAVIS_DIST" = "trusty" ]; then
|
||||
echo "skip coveralls on trusty because coveralls errors out due to python issues"
|
||||
exit 0
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
pip3 install --user cpp-coveralls
|
||||
PATH="${PATH}:$(python3 -c 'import site; print(site.USER_BASE)')/bin"
|
||||
else
|
||||
pip install --user cpp-coveralls
|
||||
fi
|
||||
|
||||
export COVERALLS_PARALLEL=true
|
||||
coveralls --build-root src --exclude src/optparse.c --exclude ci --exclude config.h --gcov-options '\-lp'
|
@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
COVERITY_SCAN_PROJECT_NAME=schweikert/fping
|
||||
COVERITY_SCAN_EMAIL=david@schweikert.ch
|
||||
|
||||
if [ -z "$COVERITY_SCAN_TOKEN" ]; then
|
||||
echo "ERROR: COVERITY_SCAN_TOKEN not defined." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -o /tmp/cov-analysis-linux64.tgz https://scan.coverity.com/download/linux64 \
|
||||
--form project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN
|
||||
tar xfz /tmp/cov-analysis-linux64.tgz
|
||||
./autogen.sh
|
||||
./configure --enable-ipv4 --enable-ipv6 --enable-safe-limits --prefix=/opt/fping
|
||||
cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j4
|
||||
tar cfz cov-int.tar.gz cov-int
|
||||
curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME \
|
||||
--form token=$COVERITY_SCAN_TOKEN \
|
||||
--form email=$COVERITY_SCAN_EMAIL \
|
||||
--form file=@cov-int.tar.gz \
|
||||
--form version="`git rev-parse --short HEAD`" \
|
||||
--form description="`git rev-parse --short HEAD` / $TRAVIS_BUILD_ID "
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
lcov -c -no-external \
|
||||
-d . \
|
||||
-b src \
|
||||
-o lcov-all.info
|
||||
|
||||
lcov --remove lcov-all.info -o lcov.info \
|
||||
'*/optparse.c'
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
PATH=`pwd`/src:$PATH
|
||||
|
||||
prove ci/test-*.pl
|
||||
ci/test-tarball.sh
|
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command;
|
||||
use Test::More;
|
||||
|
||||
if( $^O eq 'darwin' ) {
|
||||
plan skip_all => 'Test irrelevant on MacOS';
|
||||
exit 0;
|
||||
}
|
||||
plan tests => 3;
|
||||
|
||||
# run without privileges
|
||||
my $fping_bin = `which fping`; chomp $fping_bin;
|
||||
system("cp $fping_bin /tmp/fping.copy; chmod +x /tmp/fping.copy");
|
||||
|
||||
# fping
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "/tmp/fping.copy 127.0.0.1");
|
||||
$cmd->exit_is_num(4);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{: can't create socket \(must run as root\?\)});
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use English;
|
||||
use Test::Command;
|
||||
use Test::More;
|
||||
|
||||
if( $^O eq 'darwin' ) {
|
||||
plan skip_all => 'Test irrelevant on MacOS';
|
||||
exit 0;
|
||||
}
|
||||
|
||||
sub get_ping_gid_range {
|
||||
open FD, "/proc/sys/net/ipv4/ping_group_range" or return undef;
|
||||
chomp(my $line = <FD>);
|
||||
my @range = split(/\s+/, $line);
|
||||
close FD;
|
||||
return @range;
|
||||
}
|
||||
|
||||
my @gids = split(' ', $EGID);
|
||||
my @allowed = get_ping_gid_range();
|
||||
|
||||
# Make a copy of the binary so that we get rid of setuid bit
|
||||
my $fping_bin = `which fping`; chomp $fping_bin;
|
||||
system("cp $fping_bin /tmp/fping.copy; chmod +x /tmp/fping.copy");
|
||||
|
||||
# Determine what test to run, based on whether unprivileged
|
||||
# pings are allowed.
|
||||
if(scalar grep { $_ >= $allowed[0] && $_ <= $allowed[1] } @gids) {
|
||||
diag('test unprivileged mode');
|
||||
test_unprivileged_works();
|
||||
}
|
||||
else {
|
||||
test_privileged_fails();
|
||||
}
|
||||
|
||||
sub test_unprivileged_works {
|
||||
plan tests => 3;
|
||||
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
}
|
||||
|
||||
sub test_privileged_fails {
|
||||
plan tests => 3;
|
||||
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "/tmp/fping.copy 127.0.0.1");
|
||||
$cmd->exit_is_num(4);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{: can't create socket \(must run as root\?\)});
|
||||
}
|
||||
}
|
@ -1,27 +1,10 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 84;
|
||||
use Test::More;
|
||||
use Test::Command tests => 33;
|
||||
|
||||
# some options require a numeric argument
|
||||
for my $arg (qw(b B c C H i O p Q r t x X)) {
|
||||
for my $test_input (qw(xxx '')) {
|
||||
my $cmd = Test::Command->new(cmd => "fping -$arg $test_input");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{Usage:});
|
||||
}
|
||||
}
|
||||
|
||||
# fping -k, only supported on Linux, requires a number
|
||||
SKIP: {
|
||||
if($^O ne 'linux') {
|
||||
skip '-k option is only supported on Linux', 6;
|
||||
}
|
||||
for my $test_input (qw(xxx '')) {
|
||||
my $cmd = Test::Command->new(cmd => "fping -k $test_input 127.0.0.1");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{Usage:});
|
||||
}
|
||||
for my $arg (qw(b B c C H i O p Q r t)) {
|
||||
my $cmd = Test::Command->new(cmd => "fping -$arg xxx");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{Usage:});
|
||||
}
|
||||
|
@ -0,0 +1,135 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command;
|
||||
use Test::More;
|
||||
|
||||
plan tests => 18;
|
||||
|
||||
# summary
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -c 2 -J 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{\{
|
||||
"hosts": \{
|
||||
"127\.0\.0\.1": \{
|
||||
"xmt": 2,
|
||||
"rcv": 2,
|
||||
"loss_percentage": 0,
|
||||
"min": \d.\d+,
|
||||
"avg": \d.\d+,
|
||||
"max": \d.\d+
|
||||
\}
|
||||
\}
|
||||
\}}
|
||||
);
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# all RTTs
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -C 2 -J 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{\{
|
||||
"hosts": \{
|
||||
"127\.0\.0\.1": \[
|
||||
\d.\d+,
|
||||
\d.\d+
|
||||
\]
|
||||
\}
|
||||
\}}
|
||||
);
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# summary with stats and outage
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -c 2 -s -o -J 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{\{
|
||||
"hosts": \{
|
||||
"127\.0\.0\.1": \{
|
||||
"xmt": 2,
|
||||
"rcv": 2,
|
||||
"loss_percentage": 0,
|
||||
"outage": 0,
|
||||
"min": \d.\d+,
|
||||
"avg": \d.\d+,
|
||||
"max": \d.\d+
|
||||
\}
|
||||
\},
|
||||
"stats": \{
|
||||
"targets": 1,
|
||||
"alive": 1,
|
||||
"unreachable": 0,
|
||||
"unknown_addresses": 0,
|
||||
"timeouts": 0,
|
||||
"icmp_echos_sent": 2,
|
||||
"icmp_echo_replies_received": 2,
|
||||
"other_icmp_received": 0,
|
||||
"min_rtt": \d.\d+,
|
||||
"avg_rtt": \d.\d+,
|
||||
"max_rtt": \d.\d+,
|
||||
"elapsed_real_time": \d.\d+
|
||||
\}
|
||||
\}}
|
||||
);
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# all RTTs with stats
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -C 2 -s -J 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{\{
|
||||
"hosts": \{
|
||||
"127\.0\.0\.1": \[
|
||||
\d.\d+,
|
||||
\d.\d+
|
||||
\]
|
||||
\},
|
||||
"stats": \{
|
||||
"targets": 1,
|
||||
"alive": 1,
|
||||
"unreachable": 0,
|
||||
"unknown_addresses": 0,
|
||||
"timeouts": 0,
|
||||
"icmp_echos_sent": 2,
|
||||
"icmp_echo_replies_received": 2,
|
||||
"other_icmp_received": 0,
|
||||
"min_rtt": \d.\d+,
|
||||
"avg_rtt": \d.\d+,
|
||||
"max_rtt": \d.\d+,
|
||||
"elapsed_real_time": \d.\d+
|
||||
\}
|
||||
\}}
|
||||
);
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# more indentation
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -c 2 --json=4 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{\{
|
||||
"hosts": \{
|
||||
"127\.0\.0\.1": \{
|
||||
"xmt": 2,
|
||||
"rcv": 2,
|
||||
"loss_percentage": 0,
|
||||
"min": \d.\d+,
|
||||
"avg": \d.\d+,
|
||||
"max": \d.\d+
|
||||
\}
|
||||
\}
|
||||
\}}
|
||||
);
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# no pretty-print
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -c 2 --json=0 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{\{"hosts":\{"127\.0\.0\.1":\{"xmt":2,"rcv":2,"loss_percentage":0,"min":\d.\d+,"avg":\d.\d+,"max":\d.\d+\}\}\}});
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
# Base
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
automake \
|
||||
m4
|
||||
|
||||
# Add source code
|
||||
COPY ./ /app
|
||||
|
||||
# Compile
|
||||
WORKDIR /app
|
||||
RUN autoreconf --install
|
||||
RUN ./configure && make && make install
|
||||
ENTRYPOINT ["fping"]
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue