vppapigen: crcchecker: harmonize the in_progress marking
The format for deprecation is "option deprecated" now,
so harmonize the in-progress marking to logically be
"option in_progress"
At the same time recognize the legacy/erroneous
types of marking, print the warning.
Change-Id: If418dfadd69ffb112550164d63d13420e51cefd7
Type: fix
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
(cherry picked from commit 6a3d4cc9a1
)
This commit is contained in:

committed by
Dave Wallace

parent
1aa63b83f9
commit
226e8e65bc
@ -96,16 +96,24 @@ def filelist_from_patchset():
|
|||||||
return set(filelist)
|
return set(filelist)
|
||||||
|
|
||||||
def is_deprecated(d, k):
|
def is_deprecated(d, k):
|
||||||
if 'options' in d[k] and 'deprecated' in d[k]['options']:
|
if 'options' in d[k]:
|
||||||
return True
|
if 'deprecated' in d[k]['options']:
|
||||||
|
return True
|
||||||
|
# recognize the deprecated format
|
||||||
|
if 'status' in d[k]['options'] and d[k]['options']['status'] == 'deprecated':
|
||||||
|
print("WARNING: please use 'option deprecated;'")
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_in_progress(d, k):
|
def is_in_progress(d, k):
|
||||||
try:
|
if 'options' in d[k]:
|
||||||
if d[k]['options']['status'] == 'in_progress':
|
if 'in_progress' in d[k]['options']:
|
||||||
return True
|
return True
|
||||||
except:
|
# recognize the deprecated format
|
||||||
return False
|
if 'status' in d[k]['options'] and d[k]['options']['status'] == 'in_progress':
|
||||||
|
print("WARNING: please use 'option in_progress;'")
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def report(new, old):
|
def report(new, old):
|
||||||
added, removed, modified, same = dict_compare(new, old)
|
added, removed, modified, same = dict_compare(new, old)
|
||||||
|
@ -77,6 +77,29 @@ git add crccheck.api
|
|||||||
git commit -m "deprecated api";
|
git commit -m "deprecated api";
|
||||||
extras/scripts/crcchecker.py --check-patchset
|
extras/scripts/crcchecker.py --check-patchset
|
||||||
|
|
||||||
|
echo "TEST 7.1: Verify we can delete deprecated message (old/confused style)"
|
||||||
|
cat >crccheck_dep.api <<EOL
|
||||||
|
option version="1.0.0";
|
||||||
|
autoreply define crccheck
|
||||||
|
{
|
||||||
|
option status="deprecated";
|
||||||
|
bool foo;
|
||||||
|
};
|
||||||
|
EOL
|
||||||
|
git add crccheck_dep.api
|
||||||
|
git commit -m "deprecated api";
|
||||||
|
# delete API
|
||||||
|
cat >crccheck_dep.api <<EOL
|
||||||
|
option version="1.0.0";
|
||||||
|
autoreply define crccheck_2
|
||||||
|
{
|
||||||
|
bool foo;
|
||||||
|
};
|
||||||
|
EOL
|
||||||
|
git add crccheck_dep.api
|
||||||
|
git commit -m "deprecated api";
|
||||||
|
extras/scripts/crcchecker.py --check-patchset
|
||||||
|
|
||||||
echo "TEST 8: Verify that we can not rename a non-deprecated message"
|
echo "TEST 8: Verify that we can not rename a non-deprecated message"
|
||||||
sed -i -e 's/crccheck_2/crccheck_3/g' crccheck.api
|
sed -i -e 's/crccheck_2/crccheck_3/g' crccheck.api
|
||||||
git add crccheck.api
|
git add crccheck.api
|
||||||
@ -107,6 +130,13 @@ git add crccheck.api
|
|||||||
git commit -m "renamed in-progress api";
|
git commit -m "renamed in-progress api";
|
||||||
extras/scripts/crcchecker.py --check-patchset
|
extras/scripts/crcchecker.py --check-patchset
|
||||||
|
|
||||||
|
echo "TEST11.1: Switch to new designation of in-progress API"
|
||||||
|
sed -i -e 's/status="in_progress"/in_progress/g' crccheck.api
|
||||||
|
git add crccheck.api
|
||||||
|
git commit -m "new designation of in-progress api";
|
||||||
|
extras/scripts/crcchecker.py --check-patchset
|
||||||
|
|
||||||
|
|
||||||
echo "TEST12: Verify we can add a field to an in-progress API"
|
echo "TEST12: Verify we can add a field to an in-progress API"
|
||||||
sed -i -e 's/foobar;/foobar; bool new_baz;/g' crccheck.api
|
sed -i -e 's/foobar;/foobar; bool new_baz;/g' crccheck.api
|
||||||
git add crccheck.api
|
git add crccheck.api
|
||||||
|
Reference in New Issue
Block a user