Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275176
b: refs/heads/master
c: 9900b5d
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Oct 17, 2011
1 parent 1314e4a commit 1e29520
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3d1cc41432b0491a39a3185b52bfa1d0411bba10
refs/heads/master: 9900b5dc067551fcdcaec63d013b1d95b36835ae
17 changes: 16 additions & 1 deletion trunk/tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,13 @@ sub process_compare {
return $ret;
}

sub value_defined {
my ($val) = @_;

return defined($variable{$2}) ||
defined($opt{$2});
}

sub process_if {
my ($name, $value) = @_;

Expand All @@ -409,13 +416,21 @@ sub process_if {
return $ret;
}

if ($val =~ /^\s*(NOT\s*)?DEFINED\s+(\S+)\s*$/) {
if (defined $1) {
return !value_defined($2);
} else {
return value_defined($2);
}
}

if ($val =~ /^\s*0\s*$/) {
return 0;
} elsif ($val =~ /^\s*\d+\s*$/) {
return 1;
}

die ("$name: $.: Undefined variable $val in if statement\n");
die ("$name: $.: Undefined content $val in if statement\n");
return 1;
}

Expand Down
17 changes: 17 additions & 0 deletions trunk/tools/testing/ktest/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,23 @@
# ELSE
# BUILD_TYPE = useconfig:${CONFIG_DIR}/config-64
#
# The DEFINED keyword can be used by the IF statements too.
# It returns true if the given config variable or option has been defined
# or false otherwise.
#
#
# DEFAULTS IF DEFINED USE_CC
# CC := ${USE_CC}
# ELSE
# CC := gcc
#
#
# As well as NOT DEFINED.
#
# DEFAULTS IF NOT DEFINED MAKE_CMD
# MAKE_CMD := make ARCH=x86
#
#
#
# INCLUDE file
#
Expand Down

0 comments on commit 1e29520

Please sign in to comment.