Skip to content

Commit 2c81d66

Browse files
committed
Added simple tests for the new cases our fixes address (other than the buildworld and buildkernel mess)
1 parent 311ee2b commit 2c81d66

File tree

6 files changed

+80
-0
lines changed

6 files changed

+80
-0
lines changed

test/Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# currently many works; neither one nor two, nor mix work
2+
# one possibility is to do each .c file in turn
3+
# essentially turning one and two into many.
4+
#
5+
# two strategies:
6+
7+
# the important
8+
# point is to make sure for each generated .*.bc file that
9+
# there is a corresponding *.o file. so we may have to alter
10+
# both "stages" of the compilation, or extend the second one substantially.
11+
12+
# just alter the second phase to get the many.
13+
# Including the thing we are not supposed be able to do
14+
# which is attach the bit bitcode paths directly to the executable.
15+
# in the mix version we will need to to append to a section. which
16+
# has to be done by reading, removing then wrtiting the section.
17+
18+
zero:
19+
${CXX} hello.cc -o hello
20+
21+
one:
22+
${CC} foo.c bar.c baz.c main.c -o main
23+
24+
two:
25+
${CC} foo.c bar.c baz.c main.c -c
26+
${CC} foo.o bar.o baz.o main.o -o main
27+
28+
mix:
29+
${CC} foo.c bar.c -c
30+
${CC} foo.o bar.o baz.c main.c -o main
31+
32+
many:
33+
${CC} foo.c -c
34+
${CC} bar.c -c
35+
${CC} baz.c -c
36+
${CC} main.c -c
37+
${CC} -Ioff/in/lala/land -I some/where/else foo.o bar.o baz.o main.o -lm -Lz -o main
38+
39+
40+
clean:
41+
rm -f *.o main .*.o.bc .*.o *.bc .*.bc a.out *.s *.i hello
42+

test/bar.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <stdio.h>
2+
3+
4+
void bar(void){
5+
fprintf(stderr, "bar\n");
6+
}

test/baz.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <stdio.h>
2+
3+
4+
void baz(void){
5+
fprintf(stderr, "baz\n");
6+
}

test/foo.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <stdio.h>
2+
3+
4+
void foo(void){
5+
fprintf(stderr, "foo\n");
6+
}

test/hello.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <iostream>
2+
3+
4+
int main(int argc, char** argv){
5+
6+
std::cout << "Hello World" << std::endl;
7+
8+
return 0;
9+
}

test/main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
extern void foo(void);
3+
extern void bar(void);
4+
extern void baz(void);
5+
6+
int main(int argc, char** argv){
7+
foo();
8+
bar();
9+
baz();
10+
return 0;
11+
}

0 commit comments

Comments
 (0)