dhcpd: Add test cases of service dhcpd.
PATCH v3 1/1 dhcpd: Add test cases of service dhcpd.
DHCP allows hosts on a TCP/IP network to request and be assigned IP addresses, and also to discover information about the network to which they are attached. This is a simple test to check the service can start successfully.
Signed-off-by Wang Mingyu <[email protected]>
--- tests/Functional.dhcpd/data/change_dhcpd.conf | 5 ++ tests/Functional.dhcpd/dhcpd_test.sh | 4 + tests/Functional.dhcpd/fuego_test.sh | 23 ++++++ tests/Functional.dhcpd/parser.py | 20 +++++ tests/Functional.dhcpd/spec.json | 6 ++ tests/Functional.dhcpd/test.yaml | 27 +++++++ tests/Functional.dhcpd/tests/dhcpd_pidfile.sh | 102 ++++++++++++++++++++++++++ tests/Functional.dhcpd/tests/dhcpd_ps.sh | 100 +++++++++++++++++++++++++ tests/Functional.dhcpd/tests/dhcpd_syslog.sh | 94 ++++++++++++++++++++++++ 9 files changed, 381 insertions(+) create mode 100644 tests/Functional.dhcpd/data/change_dhcpd.conf create mode 100644 tests/Functional.dhcpd/dhcpd_test.sh create mode 100644 tests/Functional.dhcpd/fuego_test.sh create mode 100644 tests/Functional.dhcpd/parser.py create mode 100644 tests/Functional.dhcpd/spec.json create mode 100644 tests/Functional.dhcpd/test.yaml create mode 100644 tests/Functional.dhcpd/tests/dhcpd_pidfile.sh create mode 100644 tests/Functional.dhcpd/tests/dhcpd_ps.sh create mode 100644 tests/Functional.dhcpd/tests/dhcpd_syslog.sh
tests/Functional.dhcpd/data/change_dhcpd.conf new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/sh + +echo " subnet router netmask 255.255.255.0 {" >> /etc/dhcp/dhcpd.conf +echo " range addr_range1 addr_range2;" >> /etc/dhcp/dhcpd.conf +echo " } " >> /etc/dhcp/dhcpd.conf
tests/Functional.dhcpd/dhcpd_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
tests/Functional.dhcpd/fuego_test.sh new file +23 -0
@@ -0,0 +1,23 @@ +function test_pre_check { + assert_has_program dhcpd +} + +function test_deploy { + put $TEST_HOME/dhcpd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put $FUEGO_CORE/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + export router=$ROUTER;\ + export addr_range1=$ADDR_RANGE1;\ + export addr_range2=$ADDR_RANGE2;\ + export broadcast_addr=$BROADCAST_ADDR;\ + ./dhcpd_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
tests/Functional.dhcpd/parser.py new file +20 -0
@@ -0,0 +1,20 @@ +#!/usr/bin/python +# See common.py for description of command-line arguments + +import os, sys, collections +import common as plib + +measurements = {} +measurements = collections.OrderedDict() + +regex_string = '^ -> (.*): TEST-(.*)$' +matches = plib.parse_log(regex_string) + +if matches: + for m in matches: + measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL' + +# split the output for each testcase +plib.split_output_per_testcase(regex_string, measurements) + +sys.exit(plib.process(measurements))
tests/Functional.dhcpd/spec.json new file +6 -0
@@ -0,0 +1,6 @@ +{ + "testName": "Functional.dhcpd", + "specs": { + "default": {} + } +}
tests/Functional.dhcpd/test.yaml new file +27 -0
@@ -0,0 +1,27 @@ +fuego_package_version: 1 +name: Functional.dhcpd +description: | + The Internet Systems Consortium DHCP Server, dhcpd, implements the Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap Protocol (BOOTP). + DHCP allows hosts on a TCP/IP network to request and be assigned IP addresses, and also to discover information about the network to which they are attached. + BOOTP provides similar functionality, with certain restrictions. + This is a simple test to check the service can start successfully. +license: BSD-3-Clause +author: Wang Mingyu <[email protected]> +maintainer: Wang Mingyu <[email protected]> +version: 1.00 +fuego_release: 1 +type: Functional +tags: ['vlan'] +params: + ROUTER="the static route of your target board" Defined in board file + ADDR_RANGE1="the start of address pool of your target board" Defined in board file + ADDR_RANGE2="the end of address pool of your target board" Defined in board file + BROADCAST_ADDR="the broadcast address of your target board" Defined in board file +data_files: + - data + - dhcpd_test.sh + - fuego_test.sh + - parser.py + - spec.json + - test.yaml + - tests
tests/Functional.dhcpd/tests/dhcpd_pidfile.sh new file +102 -0
102 lines not on this page · raw message
tests/Functional.dhcpd/tests/dhcpd_ps.sh new file +100 -0
100 lines not on this page · raw message
tests/Functional.dhcpd/tests/dhcpd_syslog.sh new file +94 -0
94 lines not on this page · raw message
Signature · 1 line
1.8.3.1