From: Cyril Hrubis <chrubis@suse.cz>
To: Xing Gu <gux.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v2 4/6] power_management: add uclinux check and move some check
Date: Mon, 9 Feb 2015 15:19:52 +0100 [thread overview]
Message-ID: <20150209141952.GC7605@rei.suse.de> (raw)
In-Reply-To: <1423212090-24164-4-git-send-email-gux.fnst@cn.fujitsu.com>
Hi!
> diff --git a/testcases/kernel/power_management/pm_check_env.sh b/testcases/kernel/power_management/pm_check_env.sh
> new file mode 100755
> index 0000000..ebfaf08
> --- /dev/null
> +++ b/testcases/kernel/power_management/pm_check_env.sh
> @@ -0,0 +1,41 @@
> +#
> +# Copyright (c) 2015 Fujitsu Ltd.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License along
> +# with this program; if not, write to the Free Software Foundation, Inc.,
> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> +#
> +
> +check_env() {
> + # Checking the system type
> + ./pm_check_uclinux; rc=$?
> + if [ $rc -eq 1 ]; then
> + tst_brkm TCONF "UCLINUX not supported; not running testcases"
> + fi
> +
> + # Checking required kernel version and architecture
> + tst_kvercmp 2 6 21; rc=$?
> + if [ $rc -ne 1 -a $rc -ne 2 ] ; then
> + tst_brkm TCONF "Kernel version not supported; not running \
> + testcases"
> + else
> + case "$(uname -m)" in
> + i[4-6]86|x86_64)
> + ;;
> + *)
> + tst_brkm TCONF "Arch not supported; not running \
> + testcases"
> + ;;
> + esac
> + fi
> +}
> diff --git a/testcases/kernel/power_management/pm_check_uclinux.c b/testcases/kernel/power_management/pm_check_uclinux.c
> new file mode 100644
> index 0000000..e3823b1
> --- /dev/null
> +++ b/testcases/kernel/power_management/pm_check_uclinux.c
> @@ -0,0 +1,29 @@
> +/*
> + * Copyright (c) 2015 Fujitsu Ltd.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> + */
> +
> +/* Check wether the current system is uclinux. */
> +int main(int argc, char **argv)
> +{
> + int chkcmp;
> +#ifdef UCLINUX
> + chkcmp = 1;
> +#else
> + chkcmp = 0;
> +#endif
> + return chkcmp;
> +}
I do not like this. It's compile time check executed in runtime. The
configure check is far better.
> diff --git a/testcases/kernel/power_management/runpwtests.sh b/testcases/kernel/power_management/runpwtests.sh
> index 9055964..0a66dc4 100755
> --- a/testcases/kernel/power_management/runpwtests.sh
> +++ b/testcases/kernel/power_management/runpwtests.sh
> @@ -42,6 +42,7 @@ YES=0
> NO=1
> #List of reusable functions defined in pm_include.sh
> . pm_include.sh
> +. pm_check_env.sh
Is the same check needed in more than one file?
Because if it's not there is no need to move it into separate file...
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2015-02-09 14:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 8:41 [LTP] [PATCH v2 1/6] lib/sched_mc.py: fix path for ebizzy/kernbench benchmark Xing Gu
2015-02-06 8:41 ` [LTP] [PATCH v2 2/6] power_management: compile and install testcases/kernel/power_management by default Xing Gu
2015-02-09 14:10 ` Cyril Hrubis
2015-02-06 8:41 ` [LTP] [PATCH v2 3/6] power_management: install lib/sched_mc.py into testcases/bin directory Xing Gu
2015-02-09 14:17 ` Cyril Hrubis
[not found] ` <54DC3837.8050300@cn.fujitsu.com>
2015-02-24 9:36 ` Cyril Hrubis
2015-02-06 8:41 ` [LTP] [PATCH v2 4/6] power_management: add uclinux check and move some check Xing Gu
2015-02-09 14:19 ` Cyril Hrubis [this message]
2015-02-09 14:22 ` Cyril Hrubis
2015-02-06 8:41 ` [LTP] [PATCH v2 5/6] power_management: cleanup Xing Gu
2015-02-09 14:39 ` Cyril Hrubis
[not found] ` <54DC3853.7030203@cn.fujitsu.com>
2015-02-24 9:44 ` Cyril Hrubis
2015-02-06 8:41 ` [LTP] [PATCH v2 6/6] power_management: add it into default Xing Gu
2015-02-09 14:49 ` [LTP] [PATCH v2 1/6] lib/sched_mc.py: fix path for ebizzy/kernbench benchmark Cyril Hrubis
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=20150209141952.GC7605@rei.suse.de \
--to=chrubis@suse.cz \
--cc=gux.fnst@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
/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