mirror of
https://github.com/opnsense/src.git
synced 2026-02-20 00:11:07 -05:00
Standardize the utilities from nuage.lua, to return nil on failure, plus an error message as a second result, and some value different from nil on success. Make warnmsg() and errmsg() append "nuageinit: " by default. Pass an optional second parameter as false to avoid printing this tag. Signed-off-by: Jose Luis Duran <jlduran@gmail.com> (cherry picked from commit 945632ca76117029e7bd1f46d17ccb378973daf7)
31 lines
604 B
Bash
31 lines
604 B
Bash
#-
|
|
# Copyright (c) 2022 Baptiste Daroussin <bapt@FreeBSD.org>
|
|
#
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
#
|
|
|
|
atf_test_case warn
|
|
atf_test_case err
|
|
atf_test_case dirname
|
|
|
|
warn_body()
|
|
{
|
|
atf_check -e "inline:nuageinit: plop\n" -s exit:0 /usr/libexec/flua $(atf_get_srcdir)/warn.lua
|
|
}
|
|
|
|
err_body()
|
|
{
|
|
atf_check -e "inline:nuageinit: plop\n" -s exit:1 /usr/libexec/flua $(atf_get_srcdir)/err.lua
|
|
}
|
|
|
|
dirname_body()
|
|
{
|
|
atf_check -o "inline:/my/path/\n" -s exit:0 /usr/libexec/flua $(atf_get_srcdir)/dirname.lua
|
|
}
|
|
|
|
atf_init_test_cases()
|
|
{
|
|
atf_add_test_case warn
|
|
atf_add_test_case err
|
|
atf_add_test_case dirname
|
|
}
|