Test loading files from an archive
The test requires building platform-specific code, and thus additional rules were added to the Makefile.
This commit is contained in:
parent
c1108c998f
commit
d155d87802
|
@ -2,3 +2,16 @@
|
||||||
# isn't marked as an executable (target), which CMake requires. Thus construct a
|
# isn't marked as an executable (target), which CMake requires. Thus construct a
|
||||||
# path in the same way the symbolic link is created in the goto-cc directory.
|
# path in the same way the symbolic link is created in the goto-cc directory.
|
||||||
add_test_pl_tests("$<TARGET_FILE_DIR:goto-cc>/goto-gcc")
|
add_test_pl_tests("$<TARGET_FILE_DIR:goto-cc>/goto-gcc")
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/archives/libour_archive.a"
|
||||||
|
COMMAND "$<TARGET_FILE_DIR:goto-cc>/goto-gcc" -c foo.c
|
||||||
|
COMMAND ${CMAKE_AR} rcs libour_archive.a foo.o
|
||||||
|
DEPENDS
|
||||||
|
"$<TARGET_FILE_DIR:goto-cc>/goto-gcc"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/archives/foo.c"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/archives"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(libour_archive.a ALL
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/archives/libour_archive.a"
|
||||||
|
)
|
||||||
|
|
|
@ -9,14 +9,20 @@ test:
|
||||||
tests.log: ../test.pl
|
tests.log: ../test.pl
|
||||||
|
|
||||||
else
|
else
|
||||||
test:
|
test: ../../src/goto-cc/goto-gcc
|
||||||
-@ln -s goto-cc ../../src/goto-cc/goto-gcc
|
|
||||||
@../test.pl -e -p -c ../../../src/goto-cc/goto-gcc
|
@../test.pl -e -p -c ../../../src/goto-cc/goto-gcc
|
||||||
|
|
||||||
tests.log: ../test.pl
|
tests.log: ../test.pl ../../src/goto-cc/goto-gcc
|
||||||
-@ln -s goto-cc ../../src/goto-cc/goto-gcc
|
|
||||||
@../test.pl -e -p -c ../../../src/goto-cc/goto-gcc
|
@../test.pl -e -p -c ../../../src/goto-cc/goto-gcc
|
||||||
|
|
||||||
|
../../src/goto-cc/goto-gcc: ../../src/goto-cc/goto-cc
|
||||||
|
@ln -sf goto-cc ../../src/goto-cc/goto-gcc
|
||||||
|
|
||||||
|
test tests.log: archives/libour_archive.a
|
||||||
|
archives/libour_archive.a: archives/foo.c ../../src/goto-cc/goto-gcc
|
||||||
|
@cd archives && \
|
||||||
|
../../../src/goto-cc/goto-gcc -c foo.c && \
|
||||||
|
$(AR) rcs libour_archive.a foo.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
show:
|
show:
|
||||||
|
@ -30,4 +36,4 @@ clean:
|
||||||
find -name '*.out' -execdir $(RM) '{}' \;
|
find -name '*.out' -execdir $(RM) '{}' \;
|
||||||
find -name '*.gb' -execdir $(RM) '{}' \;
|
find -name '*.gb' -execdir $(RM) '{}' \;
|
||||||
find -name '*.goto-cc-saved' -execdir $(RM) '{}' \;
|
find -name '*.goto-cc-saved' -execdir $(RM) '{}' \;
|
||||||
$(RM) tests.log
|
$(RM) tests.log archives/lib_ourarchive.a archives/foo.o
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
int foo()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
int foo();
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return foo();
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
CORE
|
||||||
|
10
|
||||||
|
main.c -L. -lour_archive --verbosity
|
||||||
|
^EXIT=0$
|
||||||
|
^SIGNAL=0$
|
||||||
|
^Reading: .*/foo.o$
|
||||||
|
--
|
||||||
|
^warning: ignoring
|
||||||
|
^CONVERSION ERROR$
|
||||||
|
--
|
||||||
|
We need to make sure main.c is listed before the archive for the Linux linker to
|
||||||
|
pick up dependencies - thus "main.c" is given as an argument on line 3 in this
|
||||||
|
file and the "10" in line 2 is a dummy to be appended at the end, setting the
|
||||||
|
verbosity as needed.
|
Loading…
Reference in New Issue