aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-07-30 10:40:50 +0200
committerVratko Polak <vrpolak@cisco.com>2019-07-31 08:00:05 +0000
commit29726f92698452f51033fc3ab52f112b74eae594 (patch)
tree7436f9dcd944c2f2b9c45fd0fb37d4ff96b6ce7a /resources/tools
parentf966718dfe763e48f2cc89e9ede2408a0f782d1b (diff)
Add VPP API CRC checking
+ Include both checking at runtime and standalone static quick check. + Runtime checking does not look for missing messages, as messages belonging to disabled plugins are not visible. + Standalone check script has nice loud output. Change-Id: I1dfc3846d1bcdad0b09017d4ce8edd5028e17e0c Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/tools')
-rw-r--r--resources/tools/integrated/__init__.py19
-rw-r--r--resources/tools/integrated/check_crc.py64
2 files changed, 83 insertions, 0 deletions
diff --git a/resources/tools/integrated/__init__.py b/resources/tools/integrated/__init__.py
new file mode 100644
index 0000000000..a708b16817
--- /dev/null
+++ b/resources/tools/integrated/__init__.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# 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
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+__init__ file for directory integrated
+
+Scripts in this directory require PYTHONPATH set to root CSIT directory,
+in order to import resources properly.
+"""
diff --git a/resources/tools/integrated/check_crc.py b/resources/tools/integrated/check_crc.py
new file mode 100644
index 0000000000..3e2836cb3b
--- /dev/null
+++ b/resources/tools/integrated/check_crc.py
@@ -0,0 +1,64 @@
+# Copyright (c) 2019 Cisco and/or its affiliates.
+# 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
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Script that fails if .api.json files downloaded to a hardcoded place
+do not match CRC checksusms currently supported by CSIT.
+
+No executable flag, nor shebang, as most users do not have .api.json
+files downloaded to the correct place.
+"""
+
+import os.path as op
+import sys
+
+from resources.libraries.python.VppApiCrc import VppApiCrcChecker
+
+# TODO: Read FDIO_VPP_DIR environment variable, or some other input,
+# instead of using hardcoded relative path?
+
+api_dir = op.normpath(op.join(
+ op.dirname(op.abspath(__file__)), "..", "..", "..", "..",
+ "build-root", "install-vpp-native", "vpp", "share", "vpp", "api"))
+checker = VppApiCrcChecker(api_dir)
+try:
+ checker.report_initial_conflicts(report_missing=True)
+except RuntimeError as err:
+ sys.stderr.write("{err!r}\n".format(err=err))
+ sys.stderr.write(
+ "\n"
+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
+ "\n"
+ "VPP CSIT API CHECK FAIL!\n"
+ "\n"
+ "This means the patch under test has missing messages,\n"
+ "or messages with unexpected CRCs compared to what CSIT needs.\n"
+ "Either this Change and/or its ancestors were editing .api files,\n"
+ "or your chain is not rebased upon the recent enough VPP codebase.\n"
+ "\n"
+ "Please rebase the patch to see if that fixes the problem.\n"
+ "If that fails email csit-dev@lists.fd.io for a new\n"
+ "operational branch supporting the api changes.\n"
+ "\n"
+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
+ )
+ sys.exit(1)
+else:
+ sys.stderr.write(
+ "\n"
+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
+ "\n"
+ "VPP CSIT API CHECK PASS!\n"
+ "\n"
+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
+ )