diff options
author | Ruben Di Battista <rubendibattista@gmail.com> | 2025-01-26 23:23:35 (GMT) |
---|---|---|
committer | Ruben Di Battista <rubendibattista@gmail.com> | 2025-01-26 23:23:35 (GMT) |
commit | dae3e49cd61da02e927a0ed4bda2f2c6cb5d27cf (patch) | |
tree | 842e46dfb6a751348064acb47b6ffa79a2220b97 /test | |
parent | 75754213c78031cecb668e1c93a382cb1366da55 (diff) | |
download | SCons-dae3e49cd61da02e927a0ed4bda2f2c6cb5d27cf.zip SCons-dae3e49cd61da02e927a0ed4bda2f2c6cb5d27cf.tar.gz SCons-dae3e49cd61da02e927a0ed4bda2f2c6cb5d27cf.tar.bz2 |
:white_check_mark: Add test
Diffstat (limited to 'test')
-rw-r--r-- | test/Configure/CheckLibWithHeader_extra_libs.py | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/test/Configure/CheckLibWithHeader_extra_libs.py b/test/Configure/CheckLibWithHeader_extra_libs.py new file mode 100644 index 0000000..9d5f300 --- /dev/null +++ b/test/Configure/CheckLibWithHeader_extra_libs.py @@ -0,0 +1,94 @@ +""" +Verify that a program which depends on library which in turns depend on another library +can be built correctly using CheckLibWithHeader +""" + +from pathlib import Path + +from TestSCons import TestSCons + +test = TestSCons(match=TestSCons.match_re_dotall) + + +libA_dir = Path(test.workdir) / "libA" +libA_dir.mkdir() +test.write( + str(libA_dir / "libA.h"), + """\ +void libA(); +""", +) +test.write( + str(libA_dir / "libA.c"), + """\ +#include <stdio.h> +#include "libA.h" + +void libA() { + printf("libA\\n"); +} +""", +) +test.write( + str(libA_dir / "SConstruct"), + """\ +SharedLibrary('libA', source=['libA.c']) +""", +) +test.run(chdir=libA_dir) + + +libB_dir = Path(test.workdir) / "libB" +libB_dir.mkdir() +test.write( + str(libB_dir / "libB.h"), + """\ +void libB(); +""", +) +test.write( + str(libB_dir / "libB.c"), + """\ +#include <stdio.h> +#include "libA.h" +#include "libB.h" + +void libB () { + libA(); +} +""", +) +test.write( + str(libB_dir / "SConstruct"), + """\ +SharedLibrary( + 'libB', + source=['libB.c'], + LIBS=['A'], + LIBPATH='../libA', + CPPPATH='../libA', +) +""", +) +test.run(chdir=libB_dir) + +test.write( + "SConstruct", + """\ +import os +env = Environment(ENV=os.environ, CPPPATH=['libB', 'libA'], LIBPATH=['libB', 'libA']) +conf = Configure(env) + +ret = conf.CheckLibWithHeader( + ['B'], + header="libB.h", + language='C', + extra_libs=['A'], + call='libB();', + autoadd=False, +) +assert ret +""", +) +test.run() +test.pass_test() |