Skip to content

Commit

Permalink
test cases: add test for @OUTPUT0@ substitution rules
Browse files Browse the repository at this point in the history
when a generator used a single @OUTPUT0@ and was processing multiple targets,
the variable was replaced with a wrong value
  • Loading branch information
chubinou committed Aug 8, 2024
1 parent b04ac25 commit d94bf57
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions test cases/common/52 object generator/dir/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#check with a single @OUTPUT0@ in a subdirectory and multiple inputs
gen4 = generator(python,
output : ['@BASENAME@.o'],
arguments : [comp, cc, '@INPUT@', '@OUTPUT0@'])

generated4 = gen4.process(files('source5.c', 'source6.c'))
3 changes: 3 additions & 0 deletions test cases/common/52 object generator/dir/source5.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int func5_in_obj(void) {
return 0;
}
3 changes: 3 additions & 0 deletions test cases/common/52 object generator/dir/source6.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int func6_in_obj(void) {
return 0;
}
4 changes: 3 additions & 1 deletion test cases/common/52 object generator/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ gen3 = generator(python,

generated3 = gen3.process(['source4.c'])

e = executable('prog', 'prog.c', generated, generated2, generated3)
subdir('dir')

e = executable('prog', 'prog.c', generated, generated2, generated3, generated4)

test('objgen', e)
5 changes: 4 additions & 1 deletion test cases/common/52 object generator/prog.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ int func1_in_obj(void);
int func2_in_obj(void);
int func3_in_obj(void);
int func4_in_obj(void);
int func5_in_obj(void);
int func6_in_obj(void);


int main(void) {
return func1_in_obj() + func2_in_obj() + func3_in_obj() + func4_in_obj();
return func1_in_obj() + func2_in_obj() + func3_in_obj() + func4_in_obj() + func5_in_obj() + func6_in_obj();
}

0 comments on commit d94bf57

Please sign in to comment.