Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions meta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ SYMBOLS = $(OBJ:=.symbols)

all: toolsversions saisanitycheck saimetadatatest saiserializetest saidepgraph.svg $(SYMBOLS)
./checkheaders.pl ../inc ../inc
./checkenumlock.sh
./saimetadatatest >/dev/null
./saiserializetest >/dev/null
./saisanitycheck
Expand Down
38 changes: 38 additions & 0 deletions meta/checkenumlock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
#
# Copyright (c) 2014 Microsoft Open Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
# FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
#
# See the Apache Version 2.0 License for specific language governing
# permissions and limitations under the License.
#
# Microsoft would like to thank the following companies for their review and
# assistance with these files: Intel Corporation, Mellanox Technologies Ltd,
# Dell Products, L.P., Facebook, Inc., Marvell International Ltd.
#
# @file checkenumlock.sh
#
# @brief This module defines SAI enum values integration check for 2 header directories
#

set -e

rm -rf temp

mkdir temp

git --work-tree=temp/ checkout origin/master inc

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

./checkheaders.pl -s ../inc/ temp/inc/

rm -rf temp
27 changes: 26 additions & 1 deletion meta/checkheaders.pl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@

use File::Temp qw/ tempfile /;
use Data::Dumper;
use Getopt::Std;

my %options = ();
getopts("s", \%options);

my $optionSkipSingleDefined = 1 if defined $options{s};

use utils;

Expand Down Expand Up @@ -176,9 +182,28 @@ sub CheckHash

for my $key (sort keys %A)
{
if (defined $optionSkipSingleDefined)
{
# ignore attributes end, since those will shift
next if $key =~ /^SAI_\w+_ATTR_END$/;

next if $key eq "SAI_ACL_TABLE_ATTR_FIELD_END";
next if $key eq "SAI_ACL_ENTRY_ATTR_FIELD_END";
next if $key eq "SAI_ACL_ENTRY_ATTR_ACTION_END";

# NOTE: some other attributes/enum with END range could be added
}

if (not defined $B{$key})
{
LogError "enum $key only defined in $A{$key}{path}:$A{$key}{nr}";
if (not defined $optionSkipSingleDefined)
{
LogError "enum $key only defined in $A{$key}{path}:$A{$key}{nr}"
}
else
{
LogInfo "enum $key only defined in $A{$key}{path}:$A{$key}{nr}"
}
next;
}

Expand Down
12 changes: 6 additions & 6 deletions meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -4615,7 +4615,7 @@ void check_get_attr_metadata()

void check_acl_user_defined_field()
{
SAI_META_LOG_ENTER();
META_LOG_ENTER();

META_ASSERT_TRUE(SAI_ACL_USER_DEFINED_FIELD_ATTR_ID_RANGE > 0, "should be positive");

Expand All @@ -4628,14 +4628,14 @@ void check_acl_user_defined_field()

void check_label_size()
{
SAI_META_LOG_ENTER();
META_LOG_ENTER();

META_ASSERT_TRUE(sizeof(sai_label_id_t) == sizeof(uint32_t), "label is expected to be 32 bit");
}

void check_switch_notify_list()
{
SAI_META_LOG_ENTER();
META_LOG_ENTER();

size_t i;

Expand All @@ -4651,7 +4651,7 @@ void check_switch_notify_list()

void check_switch_pointers_list()
{
SAI_META_LOG_ENTER();
META_LOG_ENTER();

size_t i;

Expand All @@ -4667,7 +4667,7 @@ void check_switch_pointers_list()

void check_defines()
{
SAI_META_LOG_ENTER();
META_LOG_ENTER();

/*
* Check if defines are equal to their static values.
Expand All @@ -4679,7 +4679,7 @@ void check_defines()

void check_object_type_attributes()
{
SAI_META_LOG_ENTER();
META_LOG_ENTER();

size_t i = 0;

Expand Down