diff mbox

[PULL,23/40] qapi: Remove obsolete tests for MAX collision

Message ID 1450341225-2735-24-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Dec. 17, 2015, 8:33 a.m. UTC
From: Eric Blake <eblake@redhat.com>

Now that we no longer collide with an implicit _MAX enum member,
we no longer need to reject it in the ad hoc parser, and can
remove several tests that are no longer needed.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1447836791-369-24-git-send-email-eblake@redhat.com>
[Commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/qapi.py                        | 8 +++-----
 tests/Makefile                         | 3 ---
 tests/qapi-schema/enum-max-member.err  | 1 -
 tests/qapi-schema/enum-max-member.exit | 1 -
 tests/qapi-schema/enum-max-member.json | 3 ---
 tests/qapi-schema/enum-max-member.out  | 0
 tests/qapi-schema/event-max.err        | 1 -
 tests/qapi-schema/event-max.exit       | 1 -
 tests/qapi-schema/event-max.json       | 2 --
 tests/qapi-schema/event-max.out        | 0
 tests/qapi-schema/union-max.err        | 1 -
 tests/qapi-schema/union-max.exit       | 1 -
 tests/qapi-schema/union-max.json       | 3 ---
 tests/qapi-schema/union-max.out        | 0
 14 files changed, 3 insertions(+), 22 deletions(-)
 delete mode 100644 tests/qapi-schema/enum-max-member.err
 delete mode 100644 tests/qapi-schema/enum-max-member.exit
 delete mode 100644 tests/qapi-schema/enum-max-member.json
 delete mode 100644 tests/qapi-schema/enum-max-member.out
 delete mode 100644 tests/qapi-schema/event-max.err
 delete mode 100644 tests/qapi-schema/event-max.exit
 delete mode 100644 tests/qapi-schema/event-max.json
 delete mode 100644 tests/qapi-schema/event-max.out
 delete mode 100644 tests/qapi-schema/union-max.err
 delete mode 100644 tests/qapi-schema/union-max.exit
 delete mode 100644 tests/qapi-schema/union-max.json
 delete mode 100644 tests/qapi-schema/union-max.out

diff --git a/tests/qapi-schema/union-max.out b/tests/qapi-schema/union-max.out
deleted file mode 100644
index e69de29..0000000
diff mbox

Patch

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 9c541e0..6acef1f 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -537,8 +537,6 @@  def check_event(expr, expr_info):
     global events
     name = expr['event']
 
-    if name.upper() == 'MAX':
-        raise QAPIExprError(expr_info, "Event name 'MAX' cannot be created")
     events.append(name)
     check_type(expr_info, "'data' for event '%s'" % name,
                expr.get('data'), allow_dict=True, allow_optional=True,
@@ -550,7 +548,7 @@  def check_union(expr, expr_info):
     base = expr.get('base')
     discriminator = expr.get('discriminator')
     members = expr['data']
-    values = {'MAX': '(automatic)'}
+    values = {}
 
     # Two types of unions, determined by discriminator.
 
@@ -629,7 +627,7 @@  def check_union(expr, expr_info):
 def check_alternate(expr, expr_info):
     name = expr['alternate']
     members = expr['data']
-    values = {'MAX': '(automatic)'}
+    values = {}
     types_seen = {}
 
     # Check every branch
@@ -662,7 +660,7 @@  def check_enum(expr, expr_info):
     name = expr['enum']
     members = expr.get('data')
     prefix = expr.get('prefix')
-    values = {'MAX': '(automatic)'}
+    values = {}
 
     if not isinstance(members, list):
         raise QAPIExprError(expr_info,
diff --git a/tests/Makefile b/tests/Makefile
index 2f6b234..0f4914c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -267,14 +267,12 @@  qapi-schema += enum-bad-prefix.json
 qapi-schema += enum-clash-member.json
 qapi-schema += enum-dict-member.json
 qapi-schema += enum-int-member.json
-qapi-schema += enum-max-member.json
 qapi-schema += enum-missing-data.json
 qapi-schema += enum-wrong-data.json
 qapi-schema += escape-outside-string.json
 qapi-schema += escape-too-big.json
 qapi-schema += escape-too-short.json
 qapi-schema += event-case.json
-qapi-schema += event-max.json
 qapi-schema += event-nest-struct.json
 qapi-schema += flat-union-array-branch.json
 qapi-schema += flat-union-bad-base.json
@@ -347,7 +345,6 @@  qapi-schema += union-clash-branches.json
 qapi-schema += union-clash-data.json
 qapi-schema += union-empty.json
 qapi-schema += union-invalid-base.json
-qapi-schema += union-max.json
 qapi-schema += union-optional-branch.json
 qapi-schema += union-unknown.json
 qapi-schema += unknown-escape.json
diff --git a/tests/qapi-schema/enum-max-member.err b/tests/qapi-schema/enum-max-member.err
deleted file mode 100644
index f77837f..0000000
--- a/tests/qapi-schema/enum-max-member.err
+++ /dev/null
@@ -1 +0,0 @@ 
-tests/qapi-schema/enum-max-member.json:3: Enum 'MyEnum' member 'max' clashes with '(automatic)'
diff --git a/tests/qapi-schema/enum-max-member.exit b/tests/qapi-schema/enum-max-member.exit
deleted file mode 100644
index d00491f..0000000
--- a/tests/qapi-schema/enum-max-member.exit
+++ /dev/null
@@ -1 +0,0 @@ 
-1
diff --git a/tests/qapi-schema/enum-max-member.json b/tests/qapi-schema/enum-max-member.json
deleted file mode 100644
index 4bcda0b..0000000
--- a/tests/qapi-schema/enum-max-member.json
+++ /dev/null
@@ -1,3 +0,0 @@ 
-# we reject user-supplied 'max' for clashing with implicit enum end
-# TODO: should we instead munge the implicit value to avoid the clash?
-{ 'enum': 'MyEnum', 'data': [ 'max' ] }
diff --git a/tests/qapi-schema/enum-max-member.out b/tests/qapi-schema/enum-max-member.out
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/qapi-schema/event-max.err b/tests/qapi-schema/event-max.err
deleted file mode 100644
index c856534..0000000
--- a/tests/qapi-schema/event-max.err
+++ /dev/null
@@ -1 +0,0 @@ 
-tests/qapi-schema/event-max.json:2: Event name 'MAX' cannot be created
diff --git a/tests/qapi-schema/event-max.exit b/tests/qapi-schema/event-max.exit
deleted file mode 100644
index d00491f..0000000
--- a/tests/qapi-schema/event-max.exit
+++ /dev/null
@@ -1 +0,0 @@ 
-1
diff --git a/tests/qapi-schema/event-max.json b/tests/qapi-schema/event-max.json
deleted file mode 100644
index f3d7de2..0000000
--- a/tests/qapi-schema/event-max.json
+++ /dev/null
@@ -1,2 +0,0 @@ 
-# an event named 'MAX' would conflict with implicit C enum
-{ 'event': 'MAX' }
diff --git a/tests/qapi-schema/event-max.out b/tests/qapi-schema/event-max.out
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/qapi-schema/union-max.err b/tests/qapi-schema/union-max.err
deleted file mode 100644
index 55ce439..0000000
--- a/tests/qapi-schema/union-max.err
+++ /dev/null
@@ -1 +0,0 @@ 
-tests/qapi-schema/union-max.json:2: Union 'Union' member 'max' clashes with '(automatic)'
diff --git a/tests/qapi-schema/union-max.exit b/tests/qapi-schema/union-max.exit
deleted file mode 100644
index d00491f..0000000
--- a/tests/qapi-schema/union-max.exit
+++ /dev/null
@@ -1 +0,0 @@ 
-1
diff --git a/tests/qapi-schema/union-max.json b/tests/qapi-schema/union-max.json
deleted file mode 100644
index d6ad986..0000000
--- a/tests/qapi-schema/union-max.json
+++ /dev/null
@@ -1,3 +0,0 @@ 
-# we reject 'max' branch in a union, for collision with C enum
-{ 'union': 'Union',
-  'data': { 'max': 'int' } }