ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: Martin Doucha <martin.doucha@suse.com>
Subject: Re: [LTP] [PATCH 1/2] tst_test.sh: Cleanup getopts usage
Date: Sat, 2 Apr 2022 00:30:32 +0200	[thread overview]
Message-ID: <Ykd9CAXfi9FZ+iHB@pevik> (raw)
In-Reply-To: <20220401215951.13976-2-pvorel@suse.cz>

Hi,

Also dhcp tests should be changed due tst_selinux_enforced being available after
dhcp_lib.sh load.

Yes, defining global variables can be tricky now, we must be careful if they
don't depend on anything (here only library defines setup function, that's why
it's outside of the function).

In case anybody wants to test this latest version is branch
tst_test.sh/cleanup-getopts.fixes in my fork:
https://github.com/pevik/ltp/commits/tst_test.sh/cleanup-getopts.fixes

Kind regards,
Petr

diff --git testcases/network/dhcp/dnsmasq_tests.sh testcases/network/dhcp/dnsmasq_tests.sh
index 8dd43124ed..0183c1da25 100755
--- testcases/network/dhcp/dnsmasq_tests.sh
+++ testcases/network/dhcp/dnsmasq_tests.sh
@@ -5,17 +5,6 @@
 #
 # Author: Alexey Kodanev alexey.kodanev@oracle.com
 
-dhcp_name="dnsmasq"
-log="/var/log/dnsmasq.tst.log"
-
-lease_dir="/var/lib/misc"
-
-lease_file="$lease_dir/dnsmasq.tst.leases"
-
-common_opt="--no-hosts --no-resolv --dhcp-authoritative \
-	--log-facility=$log --interface=$iface0 \
-	--dhcp-leasefile=$lease_file --port=0 --conf-file= "
-
 start_dhcp()
 {
 	dnsmasq $common_opt \
@@ -45,6 +34,17 @@ print_dhcp_version()
 }
 
 . dhcp_lib.sh
+
+lease_dir="/var/lib/misc"
 tst_selinux_enforced && lease_dir="/var/lib/dnsmasq"
 
+dhcp_name="dnsmasq"
+log="/var/log/dnsmasq.tst.log"
+
+lease_file="$lease_dir/dnsmasq.tst.leases"
+
+common_opt="--no-hosts --no-resolv --dhcp-authoritative \
+	--log-facility=$log --interface=$iface0 \
+	--dhcp-leasefile=$lease_file --port=0 --conf-file= "
+
 tst_run

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2022-04-01 22:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 21:59 [LTP] [PATCH 0/2] shell: Cleanup getopts usage Petr Vorel
2022-04-01 21:59 ` [LTP] [PATCH 1/2] tst_test.sh: " Petr Vorel
2022-04-01 22:11   ` Petr Vorel
2022-04-01 22:30   ` Petr Vorel [this message]
2022-04-22  9:23     ` Petr Vorel
2022-04-01 21:59 ` [LTP] [PATCH 2/2] doc: Update shell API examples Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ykd9CAXfi9FZ+iHB@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=martin.doucha@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).