Skip to content

Commit edd3efd

Browse files
committed
fbc-tests: disable some tests for arm targets
- arm targets returning NAN instead of IND - threadcall appears broken on arm - use -d ENABLE_CHECK_BUGS=1 compile time option to enable bug checks (cherry picked from commit f1f5c10)
1 parent fb945e4 commit edd3efd

File tree

4 files changed

+91
-47
lines changed

4 files changed

+91
-47
lines changed

tests/numbers/infnan.bas

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,25 @@ SUITE( fbc_tests.numbers.infnan )
66
''
77
'' Double
88
''
9+
const SGNMASK = &h7FFFFFFFFFFFFFFFull
10+
const POSINFD = &h7FF0000000000000ull
11+
const NEGINFD = &hFFF0000000000000ull
12+
const POSNAND = &h7FF8000000000000ull
13+
const NEGNAND = &hFFF8000000000000ull
914

1015
#macro checkD( d, x )
11-
'' Little-endian assumption
12-
CU_ASSERT( *cptr( ulongint ptr, @d ) = x )
16+
' The sign bit for NaN results is unspecified by IEEE754,
17+
' and x86 and ARM differ in its selection.
18+
'' Little-endian assumption casting double ptr to ulongint ptr
19+
#ifdef __FB_ARM__
20+
#if( (x = NEGNAND) or (x = POSNAND) )
21+
CU_ASSERT( ((*cptr( ulongint ptr, @d )) and SGNMASK) = POSNAND )
22+
#else
23+
CU_ASSERT( *cptr( ulongint ptr, @d ) = x )
24+
#endif
25+
#else
26+
CU_ASSERT( *cptr( ulongint ptr, @d ) = x )
27+
#endif
1328
#endmacro
1429

1530
#macro checkConstD( N, x )
@@ -36,11 +51,6 @@ SUITE( fbc_tests.numbers.infnan )
3651
end scope
3752
#endmacro
3853

39-
const POSINFD = &h7FF0000000000000ull
40-
const NEGINFD = &hFFF0000000000000ull
41-
const POSNAND = &h7FF8000000000000ull
42-
const NEGNAND = &hFFF8000000000000ull
43-
4454
checkConstD( ( 0.0 / 0.0), NEGNAND )
4555
checkConstD( ( 0.0 / -0.0), NEGNAND )
4656
checkConstD( (-0.0 / 0.0), NEGNAND )
@@ -69,15 +79,8 @@ SUITE( fbc_tests.numbers.infnan )
6979
end scope
7080
#endmacro
7181

72-
' The sign bit for NaN results is unspecified by IEEE754,
73-
' and x86 and ARM differ in its selection.
74-
#ifdef __FB_ARM__
75-
checkVarDivD( 0.0, 0.0, POSNAND )
76-
checkVarDivD( 0.0, -0.0, POSNAND )
77-
#else
78-
checkVarDivD( 0.0, 0.0, NEGNAND )
79-
checkVarDivD( 0.0, -0.0, NEGNAND )
80-
#endif
82+
checkVarDivD( 0.0, 0.0, NEGNAND )
83+
checkVarDivD( 0.0, -0.0, NEGNAND )
8184
checkVarDivD( -0.0, 0.0, NEGNAND )
8285
checkVarDivD( -0.0, -0.0, NEGNAND )
8386
checkVarDivD( 1.0, 0.0, POSINFD )
@@ -95,13 +98,8 @@ SUITE( fbc_tests.numbers.infnan )
9598
end scope
9699
#endmacro
97100

98-
#ifdef __FB_ARM__
99-
checkVarDivNegD( 0.0, 0.0, NEGNAND )
100-
checkVarDivNegD( 0.0, -0.0, NEGNAND )
101-
#else
102-
checkVarDivNegD( 0.0, 0.0, POSNAND )
103-
checkVarDivNegD( 0.0, -0.0, POSNAND )
104-
#endif
101+
checkVarDivNegD( 0.0, 0.0, POSNAND )
102+
checkVarDivNegD( 0.0, -0.0, POSNAND )
105103
checkVarDivNegD( -0.0, 0.0, POSNAND )
106104
checkVarDivNegD( -0.0, -0.0, POSNAND )
107105
checkVarDivNegD( 1.0, 0.0, NEGINFD )
@@ -115,9 +113,25 @@ SUITE( fbc_tests.numbers.infnan )
115113
'' Single
116114
''
117115

116+
const SGNMASK = &h7FFFFFFFu
117+
const POSINFF = &h7F800000u
118+
const NEGINFF = &hFF800000u
119+
const POSNANF = &h7FC00000u
120+
const NEGNANF = &hFFC00000u
121+
118122
#macro checkF( f, x )
119-
'' Little-endian assumption
120-
CU_ASSERT( *cptr( ulong ptr, @f ) = x )
123+
' The sign bit for NaN results is unspecified by IEEE754,
124+
' and x86 and ARM differ in its selection.
125+
'' Little-endian assumption casting double ptr to ulongint ptr
126+
#ifdef __FB_ARM__
127+
#if( (x = NEGNANF) or (x = POSNANF) )
128+
CU_ASSERT( ((*cptr( ulong ptr, @f )) and SGNMASK) = POSNANF )
129+
#else
130+
CU_ASSERT( *cptr( ulong ptr, @f ) = x )
131+
#endif
132+
#else
133+
CU_ASSERT( *cptr( ulong ptr, @f ) = x )
134+
#endif
121135
#endmacro
122136

123137
#macro checkConstF( N, x )
@@ -144,11 +158,6 @@ SUITE( fbc_tests.numbers.infnan )
144158
end scope
145159
#endmacro
146160

147-
const POSINFF = &h7F800000u
148-
const NEGINFF = &hFF800000u
149-
const POSNANF = &h7FC00000u
150-
const NEGNANF = &hFFC00000u
151-
152161
checkConstF( ( 0.0f / 0.0f), NEGNANF )
153162
checkConstF( ( 0.0f / -0.0f), NEGNANF )
154163
checkConstF( (-0.0f / 0.0f), NEGNANF )
@@ -177,13 +186,8 @@ SUITE( fbc_tests.numbers.infnan )
177186
end scope
178187
#endmacro
179188

180-
#ifdef __FB_ARM__
181-
checkVarDivF( 0.0f, 0.0f, POSNANF )
182-
checkVarDivF( 0.0f, -0.0f, POSNANF )
183-
#else
184-
checkVarDivF( 0.0f, 0.0f, NEGNANF )
185-
checkVarDivF( 0.0f, -0.0f, NEGNANF )
186-
#endif
189+
checkVarDivF( 0.0f, 0.0f, NEGNANF )
190+
checkVarDivF( 0.0f, -0.0f, NEGNANF )
187191
checkVarDivF( -0.0f, 0.0f, NEGNANF )
188192
checkVarDivF( -0.0f, -0.0f, NEGNANF )
189193
checkVarDivF( 1.0f, 0.0f, POSINFF )
@@ -201,13 +205,8 @@ SUITE( fbc_tests.numbers.infnan )
201205
end scope
202206
#endmacro
203207

204-
#ifdef __FB_ARM__
205-
checkVarDivNegF( 0.0f, 0.0f, NEGNANF )
206-
checkVarDivNegF( 0.0f, -0.0f, NEGNANF )
207-
#else
208-
checkVarDivNegF( 0.0f, 0.0f, POSNANF )
209-
checkVarDivNegF( 0.0f, -0.0f, POSNANF )
210-
#endif
208+
checkVarDivNegF( 0.0f, 0.0f, POSNANF )
209+
checkVarDivNegF( 0.0f, -0.0f, POSNANF )
211210
checkVarDivNegF( -0.0f, 0.0f, POSNANF )
212211
checkVarDivNegF( -0.0f, -0.0f, POSNANF )
213212
checkVarDivNegF( 1.0f, 0.0f, NEGINFF )

tests/string/print_using.bas

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include "fbcunit.bi"
22

3+
#ifndef ENABLE_CHECK_BUGS
4+
#define ENABLE_CHECK_BUGS 0
5+
#endif
6+
37
#define PRINT_IF_UNEQUAL
48

59
#define QT(s) ("""" & (s) & """")
@@ -392,6 +396,9 @@ SUITE( fbc_tests.string_.print_using )
392396
test_sng( fmt, nan, "+1.#NAN" )
393397
test_sng( fmt, -nan, "-1.#NAN" )
394398

399+
'' arm targets only return NAN instead of IND? and different signs??
400+
#if not defined( __FB_ARM__ ) or ( ENABLE_CHECK_BUGS <> 0 )
401+
395402
test_sng( fmt, ind, "-1.#IND" )
396403

397404
test_sng( "&", inf, "1.#INF" )
@@ -400,12 +407,15 @@ SUITE( fbc_tests.string_.print_using )
400407
test_sng( "&", ind, "-1.#IND" )
401408
test_sng( "#.####", ind, "%-1.#IND" )
402409
test_sng( "##.####", ind, "-1.#IND" )
410+
403411
test_sng( "##.###", ind, "%-1.$00" )
404412
test_sng( "##.##", ind, "%-1.$0" )
405413
test_sng( "##.#", ind, "%-1.$" )
406414
test_sng( "##.", ind, "%-1." )
407415
test_sng( "##", ind, "%-1" )
408416

417+
#endif
418+
409419
CLOSE_AND_TEST_FILE()
410420

411421
END_TEST

tests/threads/threadcall.bas

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
#include "fbcunit.bi"
22

3-
'' !!! TODO !!! does dos port support threads or no?
3+
'' !!! TODO !!! test dos port with threads
4+
'' !!! TODO !!! arm targets fail
45

5-
#ifndef __FB_DOS__
6+
#ifndef ENABLE_CHECK_BUGS
7+
#define ENABLE_CHECK_BUGS 0
8+
#endif
9+
10+
#if not (defined( __FB_ARM__ ) or defined( __FB_DOS__)) or ( ENABLE_CHECK_BUGS <> 0 )
11+
12+
'' fbcunit is not thread-safe - wrap the CU_ASSERT_TRUE in a mutex
13+
#undef CU_ASSERT_TRUE
14+
#macro CU_ASSERT_TRUE( expr )
15+
mutexlock mutex
16+
CU_ASSERT( (expr) <> 0 )
17+
mutexunlock mutex
18+
#endmacro
619

720
SUITE( fbc_tests.threads.threadcall_ )
821

@@ -15,6 +28,18 @@ SUITE( fbc_tests.threads.threadcall_ )
1528
dim shared OverloadedStr_Executed as integer = 0
1629
dim shared Namespace_Executed as integer = 0
1730
dim shared OtherNamespace_Executed as integer = 0
31+
32+
dim shared mutex as any ptr
33+
34+
SUITE_INIT
35+
mutex = mutexcreate()
36+
return 0
37+
END_SUITE_INIT
38+
39+
SUITE_CLEANUP
40+
mutexdestroy( mutex )
41+
return 0
42+
END_SUITE_CLEANUP
1843

1944
type SimpleSubUDT
2045
dim aa as byte
@@ -61,7 +86,7 @@ SUITE( fbc_tests.threads.threadcall_ )
6186

6287
sub FloatStr ( byval s as single, byref d as double, byref s1 as string )
6388
CU_ASSERT_TRUE( s > 14.999 and s < 15.01)
64-
CU_ASSERT( s1 = "fourteen" )
89+
CU_ASSERT_TRUE( s1 = "fourteen" )
6590

6691
' Output by reference
6792
s1 = "five"

tests/wstring/print_using.bas

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include "fbcunit.bi"
22

3+
#ifndef ENABLE_CHECK_BUGS
4+
#define ENABLE_CHECK_BUGS 0
5+
#endif
6+
37
#define PRINT_IF_UNEQUAL
48

59
#define BUFFER_SIZE 50
@@ -394,6 +398,9 @@ SUITE( fbc_tests.wstring_.print_using )
394398
test_sng( fmt, nan, "+1.#NAN" )
395399
test_sng( fmt, -nan, "-1.#NAN" )
396400

401+
'' arm targets only return NAN instead of IND? and different signs??
402+
#if not defined( __FB_ARM__ ) or ( ENABLE_CHECK_BUGS <> 0 )
403+
397404
test_sng( fmt, ind, "-1.#IND" )
398405

399406
test_sng( "&", inf, "1.#INF" )
@@ -402,12 +409,15 @@ SUITE( fbc_tests.wstring_.print_using )
402409
test_sng( "&", ind, "-1.#IND" )
403410
test_sng( "#.####", ind, "%-1.#IND" )
404411
test_sng( "##.####", ind, "-1.#IND" )
412+
405413
test_sng( "##.###", ind, "%-1.$00" )
406414
test_sng( "##.##", ind, "%-1.$0" )
407415
test_sng( "##.#", ind, "%-1.$" )
408416
test_sng( "##.", ind, "%-1." )
409417
test_sng( "##", ind, "%-1" )
410418

419+
#endif
420+
411421
CLOSE_AND_TEST_FILE()
412422

413423
END_TEST

0 commit comments

Comments
 (0)