aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/runner.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 46380a85..52b575ca 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1924,14 +1924,24 @@ if 'benchmark' not in sys.argv:
output_nicerizer=lambda x: x.replace('\n', '*'))
def test_dlfcn_data_and_fptr(self):
+ global LLVM_OPTS
+ if LLVM_OPTS: return self.skip() # LLVM opts will optimize out parent_func
+
global BUILD_AS_SHARED_LIB, EXPORTED_FUNCTIONS, EXPORTED_GLOBALS
lib_src = '''
#include <stdio.h>
int global = 42;
+ extern void parent_func(); // a function that is defined in the parent
+
void lib_fptr() {
printf("Second calling lib_fptr from main.\\n");
+ parent_func();
+ // call it also through a pointer, to check indexizing
+ void (*p_f)();
+ p_f = parent_func;
+ p_f();
}
void (*func(int x, void(*fptr)()))() {
@@ -1956,6 +1966,10 @@ if 'benchmark' not in sys.argv:
FUNCTYPE func;
+ void parent_func() {
+ printf("parent_func called from child\\n");
+ }
+
void main_fptr() {
printf("First calling main_fptr from lib.\\n");
}
@@ -1997,7 +2011,7 @@ if 'benchmark' not in sys.argv:
BUILD_AS_SHARED_LIB = 0
EXPORTED_FUNCTIONS = ['_main']
EXPORTED_GLOBALS = []
- self.do_test(src, 'In func: 13*First calling main_fptr from lib.*Second calling lib_fptr from main.*Var: 42*',
+ self.do_test(src, 'In func: 13*First calling main_fptr from lib.*Second calling lib_fptr from main.*parent_func called from child*parent_func called from child*Var: 42*',
output_nicerizer=lambda x: x.replace('\n', '*'))
def test_strtod(self):
@@ -3050,20 +3064,22 @@ else:
#include<string.h>
#include<stdlib.h>
int main() {
- int N = 4*1024*1024;
+ int N = 1024*1024;
+ int M = 600;
int final = 0;
char *buf = (char*)malloc(N);
- for (int t = 0; t < 20; t++) {
+ for (int t = 0; t < M; t++) {
for (int i = 0; i < N; i++)
- buf[i] = (i*i + final)%256;
+ buf[i] = (i + final)%256;
for (int i = 0; i < N; i++)
final += buf[i] & 1;
+ final = final % 1000;
}
printf("final: %d.\\n", final);
return 1;
}
'''
- self.do_benchmark(src, [], 'final: 41943040.')
+ self.do_benchmark(src, [], 'final: 800.')
def test_fannkuch(self):
src = open(path_from_root('tests', 'fannkuch.cpp'), 'r').read()