Skip to content

Commit d89ea47

Browse files
committed
Enhance enum checker to include meta header files
Signed-off-by: Tejaswini Chadaga <tchadaga@microsoft.com>
1 parent 1f3abf9 commit d89ea47

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

meta/checkenumlock.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ rm -rf $TEMP_DIR
3737

3838
mkdir $TEMP_DIR
3939

40-
git --work-tree=$TEMP_DIR/ checkout origin/master inc experimental
40+
git --work-tree=$TEMP_DIR/ checkout origin/master inc experimental meta
4141

4242
echo "Checking for possible enum values shift (current branch vs origin/master) ..."
4343

4444
./checkheaders.pl -s ../inc/ $TEMP_DIR/inc/
4545

46+
./checkheaders.pl -s ../meta/ $TEMP_DIR/meta/
47+
48+
./checkheaders.pl -s ../experimental/ $TEMP_DIR/experimental/
49+
4650
rm -rf $TEMP_DIR

meta/checkheaders.pl

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ sub GetEnums
104104

105105
for my $file (@files)
106106
{
107+
next if $file eq "saimetadata.h";
108+
107109
my $data = ReadHeaderFile("$dir/$file");
108110

109111
my %en = FilterEnums($data, "$dir/$file");
@@ -122,7 +124,22 @@ sub ConstructSource
122124

123125
my $source = "#include <stdio.h>\n";
124126

125-
$source .= "#include \"$dir/sai.h\"\n";
127+
$source .= "#include \"$dir/../inc/sai.h\"\n";
128+
129+
if( ! -e "$dir/sai.h") {
130+
131+
my @files = GetHeaderFiles $dir;
132+
133+
for my $file (@files)
134+
{
135+
if ($file =~ /\.h$/)
136+
{
137+
$source .= "#include \"$dir/$file\"\n";
138+
}
139+
}
140+
}
141+
#if (-e "$dir/saimetadatatypes.h") {
142+
126143
$source .="int main() { ";
127144

128145
for my $en (sort keys %enums)
@@ -149,7 +166,7 @@ sub GetValues
149166

150167
my ($fhb, $bin) = tempfile( SUFFIX => '.bin', UNLINK => 1 );
151168

152-
system("gcc $src -I. -I '$dir'/../experimental -I '$dir/../custom/' -I '$dir' -o $bin") == 0 or die "gcc failed! $!";
169+
system("gcc $src -I. -I '$dir'/../experimental -I '$dir/../custom/' -I '$dir/../inc/' -I '$dir' -o $bin") == 0 or die "gcc failed! $!";
153170

154171
close $fhs;
155172
close $fhb;

0 commit comments

Comments
 (0)