Merge branch 'test-ctor-dtor' into 'master'

Add tests for constructors and destructors

See merge request redox-os/relibc!169
This commit is contained in:
jD91mZM2
2018-10-10 14:06:41 +00:00
7 changed files with 56 additions and 0 deletions
+2
View File
@@ -3,7 +3,9 @@ EXPECT_BINS=\
args \
arpainet \
assert \
constructor \
ctype \
destructor \
dirent/scandir \
error \
fcntl/create \
+21
View File
@@ -0,0 +1,21 @@
#include <stdio.h>
__attribute__((constructor))
void constructor_no_priority(void) {
puts("constructor (no priority)");
}
#define TEST(__priority) \
__attribute__((constructor(__priority))) \
void constructor_priority_##__priority(void) { \
puts("constructor ("#__priority")"); \
}
TEST(101);
TEST(102);
TEST(103);
TEST(104);
int main(int argc, char *argv[]) {
puts("main");
}
+21
View File
@@ -0,0 +1,21 @@
#include <stdio.h>
__attribute__((destructor))
void destructor_no_priority(void) {
puts("destructor (no priority)");
}
#define TEST(__priority) \
__attribute__((destructor(__priority))) \
void destructor_priority_##__priority(void) { \
puts("destructor ("#__priority")"); \
}
TEST(101);
TEST(102);
TEST(103);
TEST(104);
int main(int argc, char *argv[]) {
puts("main");
}
View File
+6
View File
@@ -0,0 +1,6 @@
constructor (101)
constructor (102)
constructor (103)
constructor (104)
constructor (no priority)
main
View File
+6
View File
@@ -0,0 +1,6 @@
main
destructor (no priority)
destructor (104)
destructor (103)
destructor (102)
destructor (101)