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:
@@ -3,7 +3,9 @@ EXPECT_BINS=\
|
||||
args \
|
||||
arpainet \
|
||||
assert \
|
||||
constructor \
|
||||
ctype \
|
||||
destructor \
|
||||
dirent/scandir \
|
||||
error \
|
||||
fcntl/create \
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
constructor (101)
|
||||
constructor (102)
|
||||
constructor (103)
|
||||
constructor (104)
|
||||
constructor (no priority)
|
||||
main
|
||||
@@ -0,0 +1,6 @@
|
||||
main
|
||||
destructor (no priority)
|
||||
destructor (104)
|
||||
destructor (103)
|
||||
destructor (102)
|
||||
destructor (101)
|
||||
Reference in New Issue
Block a user