diff mbox

[06/10] don't run sparse{c,i} tests when sparse-llvm is disabled

Message ID 53DFD320.2050903@ramsay1.demon.co.uk (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Ramsay Jones Aug. 4, 2014, 6:38 p.m. UTC
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 validation/test-suite | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

Comments

Christopher Li Sept. 27, 2014, 4:29 a.m. UTC | #1
On Tue, Aug 5, 2014 at 2:38 AM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
> +if [ ! -x "$default_path/sparse-llvm" ]; then
> +       disabled_cmds="sparsec sparsei sparse-llvm"
> +fi

I think this can  be simplified as if the test command was not found,
then that test will be disabled. It doesn't need to be sparse llvm, it
can be other
test program.

We don't need to set an disable_cmds list then check against that list.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ramsay Jones Sept. 27, 2014, 1:37 p.m. UTC | #2
On 27/09/14 05:29, Christopher Li wrote:
> On Tue, Aug 5, 2014 at 2:38 AM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
>> +if [ ! -x "$default_path/sparse-llvm" ]; then
>> +       disabled_cmds="sparsec sparsei sparse-llvm"
>> +fi
> 
> I think this can  be simplified as if the test command was not found,
> then that test will be disabled. It doesn't need to be sparse llvm, it
> can be other
> test program.

Unfortunately, sparcec and sparsei are the commands that are
used by the tests (I included sparse-llvm in the list in case
any _future_ tests used it directly), and they do exist and
are executable. They simply will not work if sparse-llvm is
not built.

I did think about removing the x-bit on sparse{c,i} in git,
enabling it again in the worktree if sparse-llvm was built,
but I was concerned that would not work on cygwin and it
would possibly complicate installation. ie I didn't try it
out seriously. This patch seemed the best solution to me.

[Another idea I didn't try: name the sparse{c,i} scripts
sparse{c,i}-in and rename them as part of a successful
build of sparse-llvm]

BTW, the 'validation/backend/sum.c' fails for me on cygwin
(64-bit), but I think it is actually a problem with the
llvm interpreter lli. (it works fine on my old 32-bit Linux
laptop).

ATB,
Ramsay Jones



--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li Sept. 30, 2014, 3:26 a.m. UTC | #3
On Sat, Sep 27, 2014 at 9:37 PM, Ramsay Jones
<ramsay@ramsay1.demon.co.uk> wrote:
> On 27/09/14 05:29, Christopher Li wrote:
>
> Unfortunately, sparcec and sparsei are the commands that are
> used by the tests (I included sparse-llvm in the list in case
> any _future_ tests used it directly), and they do exist and
> are executable. They simply will not work if sparse-llvm is
> not built.
>

I see. That make sense.

We just need a way to specify the dependency of test commands.
e.g. sparsec depends on sparse-llvm. So if sparsec does  not exist,
or sparse-llvm does  not exist, the test will be skipped.

I am thinking some thing in the test-suite like:

set_deps sparsec sparse-llvm
set_deps sparsei sparse-llvm

...
get_deps `basename cmd`
dep_cmd=$last_result

> Note that I renamed sparse{c,i} to sparse{c,i}-in. It may have been
> better to name then sparse{c,i}.sh, since they are not really templates
> to be 'processed' to create a build product. dunno.
>

I prefer specify the dependency. Another copy is not necessary.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/validation/test-suite b/validation/test-suite
index 3c011c6..0142701 100755
--- a/validation/test-suite
+++ b/validation/test-suite
@@ -7,12 +7,18 @@  default_cmd="sparse \$file"
 tests_list=`find . -name '*.c' | sed -e 's#^\./\(.*\)#\1#' | sort`
 prog_name=`basename $0`
 
+if [ ! -x "$default_path/sparse-llvm" ]; then
+	disabled_cmds="sparsec sparsei sparse-llvm"
+fi
+
 # counts:
 #	- tests that have not been converted to test-suite format
+#	- tests that are disabled
 #	- tests that passed
 #	- tests that failed
 #	- tests that failed but are known to fail
 unhandled_tests=0
+disabled_tests=0
 ok_tests=0
 ko_tests=0
 known_ko_tests=0
@@ -80,6 +86,7 @@  echo "    help                       prints usage"
 #	- 0 if the test passed,
 #	- 1 if it failed,
 #	- 2 if it is not a "test-suite" test.
+#	- 3 if the test is disabled.
 do_test()
 {
 	test_failed=0
@@ -95,8 +102,6 @@  do_test()
 	fi
 	test_name=$last_result
 
-	echo "     TEST    $test_name ($file)"
-
 	# does the test provide a specific command ?
 	cmd=`eval echo $default_path/$default_cmd`
 	get_value "check-command" $file
@@ -104,6 +109,19 @@  do_test()
 		last_result=`echo $last_result | sed -e 's/^ *//'`
 		cmd=`eval echo $default_path/$last_result`
 	fi
+
+	# check for disabled commands
+	for i in $disabled_cmds; do
+		case "$cmd" in
+		*$i*)
+			disabled_tests=`expr $disabled_tests + 1`
+			return 3
+			;;
+		esac
+	done
+
+	echo "     TEST    $test_name ($file)"
+
 	verbose "Using command       : $cmd"
 
 	# grab the expected exit value
@@ -168,6 +186,9 @@  do_test_suite()
 	if [ "$unhandled_tests" -ne "0" ]; then
 		echo "$unhandled_tests tests could not be handled by $prog_name"
 	fi
+	if [ "$disabled_tests" -ne "0" ]; then
+		echo "$disabled_tests tests were disabled"
+	fi
 }
 
 ##