add --test flag for "run once" test mode