From e1b6e263928df65854ae3d9f60b79f11f050ab59 Mon Sep 17 00:00:00 2001 From: David Seifert Date: Wed, 1 Nov 2023 18:40:10 +0100 Subject: [PATCH] unity builds: test for build failure when #files is divided by unity_size --- test cases/common/131 override options/meson.build | 12 +++++++++--- .../131 override options/{one.c => mustunity1.c} | 0 .../131 override options/{two.c => mustunity2.c} | 5 ++++- .../131 override options/{three.c => notunity1.c} | 0 .../131 override options/{four.c => notunity2.c} | 0 test cases/common/131 override options/slib.c | 8 ++++++++ test cases/common/131 override options/slib1.c | 3 +++ test cases/common/131 override options/slib2.c | 3 +++ test cases/common/131 override options/slib3.c | 3 +++ test cases/common/131 override options/slib4.c | 3 +++ test cases/common/131 override options/test.json | 5 +++++ 11 files changed, 38 insertions(+), 4 deletions(-) rename test cases/common/131 override options/{one.c => mustunity1.c} (100%) rename test cases/common/131 override options/{two.c => mustunity2.c} (55%) rename test cases/common/131 override options/{three.c => notunity1.c} (100%) rename test cases/common/131 override options/{four.c => notunity2.c} (100%) create mode 100644 test cases/common/131 override options/slib.c create mode 100644 test cases/common/131 override options/slib1.c create mode 100644 test cases/common/131 override options/slib2.c create mode 100644 test cases/common/131 override options/slib3.c create mode 100644 test cases/common/131 override options/slib4.c create mode 100644 test cases/common/131 override options/test.json diff --git a/test cases/common/131 override options/meson.build b/test cases/common/131 override options/meson.build index 4dd8d797ef84..c5081c4978ba 100644 --- a/test cases/common/131 override options/meson.build +++ b/test cases/common/131 override options/meson.build @@ -1,6 +1,12 @@ project('option override', 'c', - default_options : 'unity=on') + default_options : [ + 'unity=on', + 'unity_size=2']) -executable('mustunity', 'one.c', 'two.c') -executable('notunity', 'three.c', 'four.c', +slib_notinstalled = static_library('slib_notinstalled', ['slib1.c', 'slib2.c', 'slib3.c', 'slib4.c']) + +slib_installed = static_library('slib_installed', 'slib.c', link_with : slib_notinstalled, install : true) + +executable('mustunity', 'mustunity1.c', 'mustunity2.c', link_with : slib_installed) +executable('notunity', 'notunity1.c', 'notunity2.c', override_options : ['unity=off']) diff --git a/test cases/common/131 override options/one.c b/test cases/common/131 override options/mustunity1.c similarity index 100% rename from test cases/common/131 override options/one.c rename to test cases/common/131 override options/mustunity1.c diff --git a/test cases/common/131 override options/two.c b/test cases/common/131 override options/mustunity2.c similarity index 55% rename from test cases/common/131 override options/two.c rename to test cases/common/131 override options/mustunity2.c index 0f8048c219d8..78dc999bc85e 100644 --- a/test cases/common/131 override options/two.c +++ b/test cases/common/131 override options/mustunity2.c @@ -1,6 +1,9 @@ /* * Requires a Unity build. Otherwise hidden_func is not specified. */ + +int static_lib_func(void); + int main(void) { - return hidden_func(); + return hidden_func() + static_lib_func(); } diff --git a/test cases/common/131 override options/three.c b/test cases/common/131 override options/notunity1.c similarity index 100% rename from test cases/common/131 override options/three.c rename to test cases/common/131 override options/notunity1.c diff --git a/test cases/common/131 override options/four.c b/test cases/common/131 override options/notunity2.c similarity index 100% rename from test cases/common/131 override options/four.c rename to test cases/common/131 override options/notunity2.c diff --git a/test cases/common/131 override options/slib.c b/test cases/common/131 override options/slib.c new file mode 100644 index 000000000000..edbc305b74ee --- /dev/null +++ b/test cases/common/131 override options/slib.c @@ -0,0 +1,8 @@ +int func1(void); +int func2(void); +int func3(void); +int func4(void); + +int static_lib_func(void) { + return func1() + func2() + func3() + func4(); +} diff --git a/test cases/common/131 override options/slib1.c b/test cases/common/131 override options/slib1.c new file mode 100644 index 000000000000..35304eed65f1 --- /dev/null +++ b/test cases/common/131 override options/slib1.c @@ -0,0 +1,3 @@ +int func1(void) { + return 1; +} diff --git a/test cases/common/131 override options/slib2.c b/test cases/common/131 override options/slib2.c new file mode 100644 index 000000000000..5badf23bcb72 --- /dev/null +++ b/test cases/common/131 override options/slib2.c @@ -0,0 +1,3 @@ +int func2(void) { + return 2; +} diff --git a/test cases/common/131 override options/slib3.c b/test cases/common/131 override options/slib3.c new file mode 100644 index 000000000000..4bfe52a32a2f --- /dev/null +++ b/test cases/common/131 override options/slib3.c @@ -0,0 +1,3 @@ +int func3(void) { + return 3; +} diff --git a/test cases/common/131 override options/slib4.c b/test cases/common/131 override options/slib4.c new file mode 100644 index 000000000000..ce1fe68721d6 --- /dev/null +++ b/test cases/common/131 override options/slib4.c @@ -0,0 +1,3 @@ +int func4(void) { + return 4; +} diff --git a/test cases/common/131 override options/test.json b/test cases/common/131 override options/test.json new file mode 100644 index 000000000000..0a10fddb5989 --- /dev/null +++ b/test cases/common/131 override options/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"type": "file", "file": "usr/lib/libslib_installed.a"} + ] +}