diff --git a/interpreter.py b/interpreter.py index a3b5e6faf..ffad8819a 100644 --- a/interpreter.py +++ b/interpreter.py @@ -210,8 +210,9 @@ class ExternalLibraryHolder(InterpreterObject): return self.el.get_exe_args() class GeneratorHolder(InterpreterObject): - def __init__(self, args, kwargs): + def __init__(self, interpreter, args, kwargs): super().__init__() + self.interpreter = interpreter self.generator = build.Generator(args, kwargs) self.methods.update({'process' : self.process_method}) @@ -226,7 +227,7 @@ class GeneratorHolder(InterpreterObject): if not isinstance(a, str): raise InvalidArguments('A non-string object in "process" arguments.') gl = GeneratedListHolder(self) - [gl.add_file(a) for a in args] + [gl.add_file(os.path.join(self.interpreter.subdir, a)) for a in args] return gl class GeneratedListHolder(InterpreterObject): @@ -1085,7 +1086,7 @@ class Interpreter(): return tg def func_generator(self, node, args, kwargs): - gen = GeneratorHolder(args, kwargs) + gen = GeneratorHolder(self, args, kwargs) self.generators.append(gen) return gen diff --git a/test cases/common/30 pipeline/meson.build b/test cases/common/30 pipeline/meson.build index f639876bf..0a430bde1 100644 --- a/test cases/common/30 pipeline/meson.build +++ b/test cases/common/30 pipeline/meson.build @@ -1,14 +1,5 @@ project('pipeline test', 'c') -e1 = executable('srcgen', 'srcgen.c', native : true) - -# Generate a header file that needs to be included. -gen = generator(e1, - output : '@BASENAME@.h', - arguments : ['@INPUT@', '@OUTPUT@']) - -generated = gen.process('input_src.dat') - -e2 = executable('prog', 'prog.c', generated) - -test('pipelined', e2) \ No newline at end of file +# This is in a subdirectory to make sure +# we write proper subdir paths to output. +subdir('src') diff --git a/test cases/common/30 pipeline/input_src.dat b/test cases/common/30 pipeline/src/input_src.dat similarity index 100% rename from test cases/common/30 pipeline/input_src.dat rename to test cases/common/30 pipeline/src/input_src.dat diff --git a/test cases/common/30 pipeline/src/meson.build b/test cases/common/30 pipeline/src/meson.build new file mode 100644 index 000000000..4e9ac116a --- /dev/null +++ b/test cases/common/30 pipeline/src/meson.build @@ -0,0 +1,12 @@ +e1 = executable('srcgen', 'srcgen.c', native : true) + +# Generate a header file that needs to be included. +gen = generator(e1, + output : '@BASENAME@.h', + arguments : ['@INPUT@', '@OUTPUT@']) + +generated = gen.process('input_src.dat') + +e2 = executable('prog', 'prog.c', generated) + +test('pipelined', e2) diff --git a/test cases/common/30 pipeline/prog.c b/test cases/common/30 pipeline/src/prog.c similarity index 100% rename from test cases/common/30 pipeline/prog.c rename to test cases/common/30 pipeline/src/prog.c diff --git a/test cases/common/30 pipeline/srcgen.c b/test cases/common/30 pipeline/src/srcgen.c similarity index 100% rename from test cases/common/30 pipeline/srcgen.c rename to test cases/common/30 pipeline/src/srcgen.c