metan-ucw / runltp-ng

Minimalistic LTP testrunner
11 stars 16 forks source link

Docker based testing #38

Closed pevik closed 3 years ago

pevik commented 3 years ago

It somehow addresses https://github.com/metan-ucw/runltp-ng/issues/37 a bit.

TODO for next effort: Not sure if --sysinfo and --install makes sense when tested locally (no remote ssh). Not sure if we can easily combine docker engine (host) and docker container, that would be a real test.

I should add test which tries to run: ./install_pkg.pm --run --cmd.

Also something like this for testing exit code and error message.

test() {
    local cmd="$1"
    local exp_code="$2"
    local exp_msg="$3"
    local out

    out=$(eval $cmd 2>&1)
    if [ $? -ne $exp_code ]; then
        echo "ERROR: $1"
        exit 1
    fi
    if [ "$out" != "No packages selected!" ]; then
        echo "ERROR: unexpected error message '$err'"
        exit 1
    fi
}

test "./install_pkg.pm --distro foo" 255 "Unsupported distribution!"
test "/install_pkg.pm --distro debian" 255 "No packages selected!"

But I guess this should be written in perl using some perl framework.

metan-ucw commented 3 years ago

Looks good, Reviewed-by: Cyril Hrubis chrubis@suse.cz