Skip to content

Commit

Permalink
unity builds: test for build failure when #files is divisible by unit…
Browse files Browse the repository at this point in the history
…y_size
  • Loading branch information
SoapGentoo committed Nov 13, 2023
1 parent 701e0bb commit 7ddac9b
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test cases/common/272 unity/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
project('unity', 'c',
default_options : [
'unity_size=2'])

if get_option('unity') != 'on'
error('MESON_SKIP_TEST: unity builds not enabled')
endif

slib_notinstalled = static_library('slib_notinstalled', ['slib1.c', 'slib2.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'])
3 changes: 3 additions & 0 deletions test cases/common/272 unity/mustunity1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
static int hidden_func(void) {
return 0;
}
9 changes: 9 additions & 0 deletions test cases/common/272 unity/mustunity2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Requires a Unity build. Otherwise hidden_func is not specified.
*/

int static_lib_func(void);

int main(void) {
return hidden_func() + static_lib_func();
}
7 changes: 7 additions & 0 deletions test cases/common/272 unity/notunity1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
static int duplicate_func(void) {
return 4;
}

int func(void) {
return duplicate_func();
}
9 changes: 9 additions & 0 deletions test cases/common/272 unity/notunity2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
int func(void);

static int duplicate_func(void) {
return -4;
}

int main(void) {
return duplicate_func() + func();
}
6 changes: 6 additions & 0 deletions test cases/common/272 unity/slib.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
int func1(void);
int func2(void);

int static_lib_func(void) {
return func1() + func2();
}
3 changes: 3 additions & 0 deletions test cases/common/272 unity/slib1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int func1(void) {
return 1;
}
3 changes: 3 additions & 0 deletions test cases/common/272 unity/slib2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int func2(void) {
return 2;
}
5 changes: 5 additions & 0 deletions test cases/common/272 unity/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"installed": [
{"type": "file", "file": "usr/lib/libslib_installed.a"}
]
}

0 comments on commit 7ddac9b

Please sign in to comment.