Hangbin Liu writes:
> On Fri, Nov 24, 2023 at 03:35:51PM +0100, Petr Machata wrote:
>>
>> Hangbin Liu writes:
>>
>> > + fi
>> > + done
>> > +
>> > + [ $errexit -eq 1 ] && set -e
>> > + return 0
>> > +}
>> > +
>> > +# By default, remove all netns before EXIT.
>> > +cleanup_all_ns(
Hangbin Liu writes:
> On Fri, Nov 24, 2023 at 03:05:18PM +0100, Petr Machata wrote:
>>
>> Hangbin Liu writes:
>>
>> > +# Helpers
>> > +busywait()
>> > +{
>> > + local timeout=$1; shift
>> > +
>> > + local start_time="$(date -u +%s%3N)"
>> > + while true
>> > + do
>> > + local ou
On Fri, Nov 24, 2023 at 03:35:51PM +0100, Petr Machata wrote:
>
> Hangbin Liu writes:
>
> > +cleanup_ns()
> > +{
> > + local ns=""
> > + local errexit=0
> > +
> > + # disable errexit temporary
> > + if [[ $- =~ "e" ]]; then
> > + errexit=1
> > + set +e
> > + fi
> >
On Fri, Nov 24, 2023 at 03:05:18PM +0100, Petr Machata wrote:
>
> Hangbin Liu writes:
>
> > Add a lib.sh for net selftests. This file can be used to define commonly
> > used variables and functions.
> >
> > Add function setup_ns() for user to create unique namespaces with given
> > prefix name.
Petr Machata writes:
> Hangbin Liu writes:
>
>> +# By default, remove all netns before EXIT.
>> +cleanup_all_ns()
>> +{
>> +cleanup_ns $NS_LIST
>> +}
>> +trap cleanup_all_ns EXIT
>
> Hmm, OK, this is a showstopper for inclusion from forwarding/lib.sh,
> because basically all users of forwa
Hangbin Liu writes:
> +cleanup_ns()
> +{
> + local ns=""
> + local errexit=0
> +
> + # disable errexit temporary
> + if [[ $- =~ "e" ]]; then
> + errexit=1
> + set +e
> + fi
> +
> + for ns in "$@"; do
> + ip netns delete "${ns}" &> /de
Hangbin Liu writes:
> Add a lib.sh for net selftests. This file can be used to define commonly
> used variables and functions.
>
> Add function setup_ns() for user to create unique namespaces with given
> prefix name.
>
> Signed-off-by: Hangbin Liu
> ---
> tools/testing/selftests/net/Makefile
Add a lib.sh for net selftests. This file can be used to define commonly
used variables and functions.
Add function setup_ns() for user to create unique namespaces with given
prefix name.
Signed-off-by: Hangbin Liu
---
tools/testing/selftests/net/Makefile | 2 +-
tools/testing/selftests/net/li