diff mbox series

[RFC,2/2] Add tests for declaration-only enums.

Message ID 20200423130356.93136-3-gprocida@google.com
State Changes Requested
Headers show
Series Incomplete enum support | expand

Commit Message

Giuliano Procida April 23, 2020, 1:03 p.m. UTC
---
 tests/data/Makefile.am                         |   5 +++++
 .../test-decl-enum-report.txt                  |  17 +++++++++++++++++
 .../data/test-abidiff-exit/test-decl-enum-v0.c |   5 +++++
 .../data/test-abidiff-exit/test-decl-enum-v0.o | Bin 0 -> 3048 bytes
 .../data/test-abidiff-exit/test-decl-enum-v1.c |   5 +++++
 .../data/test-abidiff-exit/test-decl-enum-v1.o | Bin 0 -> 3048 bytes
 tests/test-abidiff-exit.cc                     |   9 +++++++++
 7 files changed, 41 insertions(+)
 create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-report.txt
 create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-v0.c
 create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-v0.o
 create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-v1.c
 create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-v1.o
diff mbox series

Patch

diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index a1b9bf64..c036f349 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -151,6 +151,11 @@  test-abidiff-exit/test-decl-struct-v0.o \
 test-abidiff-exit/test-decl-struct-v1.c \
 test-abidiff-exit/test-decl-struct-v1.o \
 test-abidiff-exit/test-decl-struct-report.txt \
+test-abidiff-exit/test-decl-enum-v0.c \
+test-abidiff-exit/test-decl-enum-v0.o \
+test-abidiff-exit/test-decl-enum-v1.c \
+test-abidiff-exit/test-decl-enum-v1.o \
+test-abidiff-exit/test-decl-enum-report.txt \
 \
 test-diff-dwarf/test0-v0.cc		\
 test-diff-dwarf/test0-v0.o			\
diff --git a/tests/data/test-abidiff-exit/test-decl-enum-report.txt b/tests/data/test-abidiff-exit/test-decl-enum-report.txt
new file mode 100644
index 00000000..e46ebfa6
--- /dev/null
+++ b/tests/data/test-abidiff-exit/test-decl-enum-report.txt
@@ -0,0 +1,17 @@ 
+Functions changes summary: 0 Removed, 2 Changed, 0 Added functions
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
+2 functions with some indirect sub-type change:
+
+  [C] 'function void reg1(const embodied_enum*)' at test-decl-enum-v1.c:4:1 has some indirect sub-type changes:
+    parameter 1 of type 'const embodied_enum*' has sub-type changes:
+      in pointed to type 'const embodied_enum':
+        in unqualified underlying type 'enum embodied_enum' at test-decl-enum-v1.c:1:1:
+          enum type enum embodied_enum was a declaration-only enum type and is now a defined enum type
+
+  [C] 'function void reg2(const disembodied_enum*)' at test-decl-enum-v1.c:5:1 has some indirect sub-type changes:
+    parameter 1 of type 'const disembodied_enum*' has sub-type changes:
+      in pointed to type 'const disembodied_enum':
+        in unqualified underlying type 'enum disembodied_enum':
+          enum type enum disembodied_enum was a defined enum type and is now a declaration-only enum type
+
diff --git a/tests/data/test-abidiff-exit/test-decl-enum-v0.c b/tests/data/test-abidiff-exit/test-decl-enum-v0.c
new file mode 100644
index 00000000..d5672618
--- /dev/null
+++ b/tests/data/test-abidiff-exit/test-decl-enum-v0.c
@@ -0,0 +1,5 @@ 
+enum embodied_enum;
+enum disembodied_enum { X };
+
+void reg1(const enum embodied_enum * foo) { (void)foo; }
+void reg2(const enum disembodied_enum * foo) { (void)foo; }
diff --git a/tests/data/test-abidiff-exit/test-decl-enum-v0.o b/tests/data/test-abidiff-exit/test-decl-enum-v0.o
new file mode 100644
index 0000000000000000000000000000000000000000..b4c0b06a089ec6adbfa81b1a619ae30087e54f9d
GIT binary patch
literal 3048
zcmbtWUuzsy6hE^wo1Hk#Hp$xBG=+{(+eDplH%QIaCa$Ko2^OhB#TN;)J2$(7+1WBP
zTT?|XqC&xk3W5lt4}JmB7hejZzU!Cp!8d&qe9&`d?%CYjOcC_J+<VUN{GEH}oZWYy
zzk0c17{Fw}I_yh~0xZ?``A*JupaJu6ee=$*n|I#+^X_XuD(v@Y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0y1`fYik>`(R6bk*w*5z}KL1V2lV>QhO#-9}|u{#BWu&x!KW
zeADyaK#XEG@loltY|^h(5P8ne`&$yz{eO`D^nIzse!RbrO6FC&-_#+YD0EwzgM{hk
zze|AUBZuJkXPM?=+4)^7xj*{#Vt+o@vfLDVQ#RB<7EHe<G*fkdx)Z(k5Q49%D5TTH
UHd*!er?_SQw`KkJyFU*24@%k9)Bpeg

literal 0
HcmV?d00001

diff --git a/tests/data/test-abidiff-exit/test-decl-enum-v1.c b/tests/data/test-abidiff-exit/test-decl-enum-v1.c
new file mode 100644
index 00000000..046a55d3
--- /dev/null
+++ b/tests/data/test-abidiff-exit/test-decl-enum-v1.c
@@ -0,0 +1,5 @@ 
+enum embodied_enum { Y };
+enum disembodied_enum;
+
+void reg1(const enum embodied_enum * foo) { (void)foo; }
+void reg2(const enum disembodied_enum * foo) { (void)foo; }
diff --git a/tests/data/test-abidiff-exit/test-decl-enum-v1.o b/tests/data/test-abidiff-exit/test-decl-enum-v1.o
new file mode 100644
index 0000000000000000000000000000000000000000..e9c8d081a21e6d3806fb79661e4fb3c333cc442d
GIT binary patch
literal 3048
zcmbtVPj4GV6o2Dg#}3=LNlZ)ARO(hLZ35jTj!=n96AUSBA}Umnir|2vwRd8#h}YHb
zx}+f53YAK^1qrFDRKbBSz!yM5z#YB>2X1gf;sEc>&e)U5_5x4ZH}C!4-}$@u-n@Rb
z#26@Ium)pIp#Te&vD^}33+gZnH#hcv+t~Z;ul)~y(!?Lo!xmmuk?e?&HFjK+OC(q9
zP2`MCT*1Nm0GaI}E8C*(1d71QVj$5WhQyxSMPAt+4A8o`hjQu59#qLxvB@-9eSka<
zw+q6*Cr=S>pCg&VC#%#0uo?Dzt?pR0`PvMdtxP|MR-0M1HOFx_>zABYou<R;*z5vW
z)l=A!eGWEJFP{a+S;IK2>$BJ9tXl4SevZ<#PCR;Jj>0Ns49hK>_0kD|stuI<@*H-3
z6jM+xxIjHoH~FN5L`+}55s1Qd{496@Ib(m<rjU!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test-abidiff-exit.cc b/tests/test-abidiff-exit.cc
index 5afc15bc..e7bf8362 100644
--- a/tests/test-abidiff-exit.cc
+++ b/tests/test-abidiff-exit.cc
@@ -203,6 +203,15 @@  InOutSpec in_out_specs[] =
     "data/test-abidiff-exit/test-decl-struct-report.txt",
     "output/test-abidiff-exit/test-decl-struct-report.txt"
   },
+  {
+    "data/test-abidiff-exit/test-decl-enum-v0.o",
+    "data/test-abidiff-exit/test-decl-enum-v1.o",
+    "",
+    "--harmless",
+    abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+    "data/test-abidiff-exit/test-decl-enum-report.txt",
+    "output/test-abidiff-exit/test-decl-enum-report.txt"
+  },
   {0, 0, 0 ,0,  abigail::tools_utils::ABIDIFF_OK, 0, 0}
 };