aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/test')
-rw-r--r--linden/indra/test/CMakeLists.txt8
-rw-r--r--linden/indra/test/llapp_tut.cpp2
-rw-r--r--linden/indra/test/llblowfish_tut.cpp12
-rw-r--r--linden/indra/test/lliohttpserver_tut.cpp4
-rw-r--r--linden/indra/test/llmodularmath_tut.cpp80
-rw-r--r--linden/indra/test/llsd_new_tut.cpp11
-rw-r--r--linden/indra/test/llstring_tut.cpp7
-rw-r--r--linden/indra/test/math.cpp6
-rw-r--r--linden/indra/test/v4math_tut.cpp15
9 files changed, 120 insertions, 25 deletions
diff --git a/linden/indra/test/CMakeLists.txt b/linden/indra/test/CMakeLists.txt
index 3d085a7..acb571b 100644
--- a/linden/indra/test/CMakeLists.txt
+++ b/linden/indra/test/CMakeLists.txt
@@ -41,6 +41,7 @@ set(test_SOURCE_FILES
41 lljoint_tut.cpp 41 lljoint_tut.cpp
42 llmime_tut.cpp 42 llmime_tut.cpp
43 llmessageconfig_tut.cpp 43 llmessageconfig_tut.cpp
44 llmodularmath_tut.cpp
44 llnamevalue_tut.cpp 45 llnamevalue_tut.cpp
45 llpermissions_tut.cpp 46 llpermissions_tut.cpp
46 llpipeutil.cpp 47 llpipeutil.cpp
@@ -88,6 +89,11 @@ if (NOT WINDOWS)
88 ) 89 )
89endif (NOT WINDOWS) 90endif (NOT WINDOWS)
90 91
92if (NOT DARWIN)
93 list(APPEND test_SOURCE_FILES
94 )
95endif (NOT DARWIN)
96
91set_source_files_properties(${test_HEADER_FILES} 97set_source_files_properties(${test_HEADER_FILES}
92 PROPERTIES HEADER_FILE_ONLY TRUE) 98 PROPERTIES HEADER_FILE_ONLY TRUE)
93 99
@@ -105,6 +111,7 @@ target_link_libraries(test
105 ${LLCOMMON_LIBRARIES} 111 ${LLCOMMON_LIBRARIES}
106 ${PTHREAD_LIBRARY} 112 ${PTHREAD_LIBRARY}
107 ${WINDOWS_LIBRARIES} 113 ${WINDOWS_LIBRARIES}
114 ${DL_LIBRARY}
108 ) 115 )
109 116
110if (WINDOWS) 117if (WINDOWS)
@@ -142,6 +149,7 @@ if (EXISTS /etc/debian_version_FAIL)
142 --mode=static 149 --mode=static
143 --output=${CMAKE_CURRENT_BINARY_DIR}/py_test_results.txt 150 --output=${CMAKE_CURRENT_BINARY_DIR}/py_test_results.txt
144 --touch=${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt 151 --touch=${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt
152 --mode=static
145 DEPENDS test.py 153 DEPENDS test.py
146 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 154 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
147 COMMENT "Python unit tests" 155 COMMENT "Python unit tests"
diff --git a/linden/indra/test/llapp_tut.cpp b/linden/indra/test/llapp_tut.cpp
index 6efced4..650d03c 100644
--- a/linden/indra/test/llapp_tut.cpp
+++ b/linden/indra/test/llapp_tut.cpp
@@ -69,7 +69,7 @@ namespace tut
69 LLSD defaults; 69 LLSD defaults;
70 defaults["template"] = "../../../scripts/messages/message_template.msg"; 70 defaults["template"] = "../../../scripts/messages/message_template.msg";
71 defaults["configdir"] = "."; 71 defaults["configdir"] = ".";
72 defaults["db_host"] = "mysql.mitra.lindenlab.com"; 72 defaults["db_host"] = "mysql.shakti.lindenlab.com";
73 defaults["db_user"] = "linden"; 73 defaults["db_user"] = "linden";
74 defaults["db_password"] = "gomez"; 74 defaults["db_password"] = "gomez";
75 defaults["datadir"] = "data"; 75 defaults["datadir"] = "data";
diff --git a/linden/indra/test/llblowfish_tut.cpp b/linden/indra/test/llblowfish_tut.cpp
index ac40896..98deff5 100644
--- a/linden/indra/test/llblowfish_tut.cpp
+++ b/linden/indra/test/llblowfish_tut.cpp
@@ -93,7 +93,7 @@ namespace tut
93 template<> template<> 93 template<> template<>
94 void blowfish_object::test<1>() 94 void blowfish_object::test<1>()
95 { 95 {
96#if !LL_LINUX 96#if LL_WINDOWS
97 skip_fail("Blowfish only supported on Linux."); 97 skip_fail("Blowfish only supported on Linux.");
98#else 98#else
99 LLUUID blank; 99 LLUUID blank;
@@ -108,13 +108,13 @@ namespace tut
108 dst_len = cipher.requiredEncryptionSpace(8); 108 dst_len = cipher.requiredEncryptionSpace(8);
109 ensure("encryption space 8", 109 ensure("encryption space 8",
110 (dst_len == 16) ); 110 (dst_len == 16) );
111#endif // !LL_LINUX 111#endif // LL_WINDOWS
112 } 112 }
113 113
114 template<> template<> 114 template<> template<>
115 void blowfish_object::test<2>() 115 void blowfish_object::test<2>()
116 { 116 {
117#if !LL_LINUX 117#if LL_WINDOWS
118 skip_fail("Blowfish only supported on Linux."); 118 skip_fail("Blowfish only supported on Linux.");
119#else 119#else
120 LLUUID blank; 120 LLUUID blank;
@@ -130,13 +130,13 @@ namespace tut
130 result.resize(count); 130 result.resize(count);
131 131
132 ensure("encrypt null key", matchFile("blowfish.1.bin", result)); 132 ensure("encrypt null key", matchFile("blowfish.1.bin", result));
133#endif // !LL_LINUX 133#endif // LL_WINDOWS
134 } 134 }
135 135
136 template<> template<> 136 template<> template<>
137 void blowfish_object::test<3>() 137 void blowfish_object::test<3>()
138 { 138 {
139#if !LL_LINUX 139#if LL_WINDOWS
140 skip_fail("Blowfish only supported on Linux."); 140 skip_fail("Blowfish only supported on Linux.");
141#else 141#else
142 // same as base64 test id 142 // same as base64 test id
@@ -153,6 +153,6 @@ namespace tut
153 result.resize(count); 153 result.resize(count);
154 154
155 ensure("encrypt real key", matchFile("blowfish.2.bin", result)); 155 ensure("encrypt real key", matchFile("blowfish.2.bin", result));
156#endif // !LL_LINUX 156#endif // LL_WINDOWS
157 } 157 }
158} 158}
diff --git a/linden/indra/test/lliohttpserver_tut.cpp b/linden/indra/test/lliohttpserver_tut.cpp
index e450cc4..38ba787 100644
--- a/linden/indra/test/lliohttpserver_tut.cpp
+++ b/linden/indra/test/lliohttpserver_tut.cpp
@@ -191,7 +191,7 @@ namespace tut
191 "HTTP/1.0 200 OK\r\n"); 191 "HTTP/1.0 200 OK\r\n");
192 192
193 ensure_contains("web/hello content type", result, 193 ensure_contains("web/hello content type", result,
194 "Content-Type: application/xml\r\n"); 194 "Content-Type: application/llsd+xml\r\n");
195 195
196 ensure_contains("web/hello content length", result, 196 ensure_contains("web/hello content length", result,
197 "Content-Length: 36\r\n"); 197 "Content-Length: 36\r\n");
@@ -232,7 +232,7 @@ namespace tut
232 "HTTP/1.0 200 OK\r\n"); 232 "HTTP/1.0 200 OK\r\n");
233 233
234 ensure_contains("web/echo content type", result, 234 ensure_contains("web/echo content type", result,
235 "Content-Type: application/xml\r\n"); 235 "Content-Type: application/llsd+xml\r\n");
236 236
237 ensure_contains("web/echo content length", result, 237 ensure_contains("web/echo content length", result,
238 "Content-Length: 35\r\n"); 238 "Content-Length: 35\r\n");
diff --git a/linden/indra/test/llmodularmath_tut.cpp b/linden/indra/test/llmodularmath_tut.cpp
new file mode 100644
index 0000000..190ca47
--- /dev/null
+++ b/linden/indra/test/llmodularmath_tut.cpp
@@ -0,0 +1,80 @@
1/**
2 * @file modularmath_tut.cpp
3 * @author babbage
4 * @date 2008-09
5 * @brief llcircuit tests
6 *
7 * $LicenseInfo:firstyear=2007&license=viewergpl$
8 *
9 * Copyright (c) 2007-2008, Linden Research, Inc.
10 *
11 * Second Life Viewer Source Code
12 * The source code in this file ("Source Code") is provided by Linden Lab
13 * to you under the terms of the GNU General Public License, version 2.0
14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 *
19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 *
24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above,
26 * and agree to abide by those obligations.
27 *
28 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
30 * COMPLETENESS OR PERFORMANCE.
31 * $/LicenseInfo$
32 */
33
34#include <tut/tut.h>
35#include "linden_common.h"
36#include "lltut.h"
37#include "llmodularmath.h"
38
39namespace tut
40{
41 struct modularmath_data
42 {
43 };
44 typedef test_group<modularmath_data> modularmath_test;
45 typedef modularmath_test::object modularmath_object;
46 tut::modularmath_test modularmath_testcase("modularmath");
47
48 template<> template<>
49 void modularmath_object::test<1>()
50 {
51 // lhs < rhs
52 const U32 lhs = 0x000001;
53 const U32 rhs = 0xFFFFFF;
54 const U32 width = 24;
55 U32 result = LLModularMath::subtract<width>(lhs, rhs);
56 ensure_equals("diff(0x000001, 0xFFFFFF, 24)", result, 2);
57 }
58
59 template<> template<>
60 void modularmath_object::test<2>()
61 {
62 // lhs > rhs
63 const U32 lhs = 0x000002;
64 const U32 rhs = 0x000001;
65 const U32 width = 24;
66 U32 result = LLModularMath::subtract<width>(lhs, rhs);
67 ensure_equals("diff(0x000002, 0x000001, 24)", result, 1);
68 }
69
70 template<> template<>
71 void modularmath_object::test<3>()
72 {
73 // lhs == rhs
74 const U32 lhs = 0xABCDEF;
75 const U32 rhs = 0xABCDEF;
76 const U32 width = 24;
77 U32 result = LLModularMath::subtract<width>(lhs, rhs);
78 ensure_equals("diff(0xABCDEF, 0xABCDEF, 24)", result, 0);
79 }
80}
diff --git a/linden/indra/test/llsd_new_tut.cpp b/linden/indra/test/llsd_new_tut.cpp
index 6c8d96a..8a24dab 100644
--- a/linden/indra/test/llsd_new_tut.cpp
+++ b/linden/indra/test/llsd_new_tut.cpp
@@ -108,7 +108,7 @@ namespace tut
108 SDCleanupCheck check; 108 SDCleanupCheck check;
109 109
110 LLSD v; 110 LLSD v;
111 111
112 v = true; ensureTypeAndValue("set true", v, true); 112 v = true; ensureTypeAndValue("set true", v, true);
113 v = false; ensureTypeAndValue("set false", v, false); 113 v = false; ensureTypeAndValue("set false", v, false);
114 v = true; ensureTypeAndValue("set true again", v, true); 114 v = true; ensureTypeAndValue("set true again", v, true);
@@ -749,6 +749,15 @@ namespace tut
749 } 749 }
750 } 750 }
751 751
752 template<> template<>
753 void SDTestObject::test<14>()
754 // make sure that assignment of char* NULL in a string does not crash.
755 {
756 LLSD v;
757 v = (const char*)NULL;
758 ensure("type is a string", v.isString());
759 }
760
752 /* TO DO: 761 /* TO DO:
753 conversion of undefined to UUID, Date, URI and Binary 762 conversion of undefined to UUID, Date, URI and Binary
754 conversion of undefined to map and array 763 conversion of undefined to map and array
diff --git a/linden/indra/test/llstring_tut.cpp b/linden/indra/test/llstring_tut.cpp
index ba6ac7c..a0fbfd1 100644
--- a/linden/indra/test/llstring_tut.cpp
+++ b/linden/indra/test/llstring_tut.cpp
@@ -344,13 +344,8 @@ namespace tut
344 str_val = "0"; 344 str_val = "0";
345 ensure("2: convertToU32 failed", LLStringUtil::convertToU32(str_val, value) && value == 0); 345 ensure("2: convertToU32 failed", LLStringUtil::convertToU32(str_val, value) && value == 0);
346 346
347#ifndef LL_DARWIN
348 str_val = "-1";
349 ensure("3: convertToU32 failed", LLStringUtil::convertToU32(str_val, value) && value == 4294967295UL);
350#endif
351
352 str_val = "4294967296"; 347 str_val = "4294967296";
353 ensure("4: convertToU32 failed", !LLStringUtil::convertToU32(str_val, value)); 348 ensure("3: convertToU32 failed", !LLStringUtil::convertToU32(str_val, value));
354 } 349 }
355 350
356 template<> template<> 351 template<> template<>
diff --git a/linden/indra/test/math.cpp b/linden/indra/test/math.cpp
index 405b8a3..dd35e21 100644
--- a/linden/indra/test/math.cpp
+++ b/linden/indra/test/math.cpp
@@ -517,6 +517,10 @@ namespace tut
517 template<> template<> 517 template<> template<>
518 void line_object::test<2>() 518 void line_object::test<2>()
519 { 519 {
520 /*
521 These tests fail intermittently on all platforms - see DEV-16600
522 Commenting this out until dev has time to investigate.
523
520 // this is a test for LLLine::nearestApproach(LLLIne) method 524 // this is a test for LLLine::nearestApproach(LLLIne) method
521 // which computes the point on a line nearest another line 525 // which computes the point on a line nearest another line
522 526
@@ -612,11 +616,13 @@ namespace tut
612 //} 616 //}
613 617
614 // test that the errors are small 618 // test that the errors are small
619
615 ensure("first line should accurately compute its closest approach", 620 ensure("first line should accurately compute its closest approach",
616 first_relative_error <= allowable_relative_error); 621 first_relative_error <= allowable_relative_error);
617 ensure("second line should accurately compute its closest approach", 622 ensure("second line should accurately compute its closest approach",
618 second_relative_error <= allowable_relative_error); 623 second_relative_error <= allowable_relative_error);
619 } 624 }
625 */
620 } 626 }
621 627
622 F32 ALMOST_PARALLEL = 0.99f; 628 F32 ALMOST_PARALLEL = 0.99f;
diff --git a/linden/indra/test/v4math_tut.cpp b/linden/indra/test/v4math_tut.cpp
index 07b4797..8169a2b 100644
--- a/linden/indra/test/v4math_tut.cpp
+++ b/linden/indra/test/v4math_tut.cpp
@@ -166,14 +166,13 @@ namespace tut
166 template<> template<> 166 template<> template<>
167 void v4math_object::test<8>() 167 void v4math_object::test<8>()
168 { 168 {
169#if LL_DEBUG && LL_WINDOWS && _MSC_VER >= 1400
170 skip_fail("This fails on VS2005 debug builds!");
171#else
172#if LL_WINDOWS && _MSC_VER < 1400
173 skip_fail("This fails on VS2003!");
174#else
175 F32 x = 10.f, y = -2.3f, z = -.023f, w = -2.0f; 169 F32 x = 10.f, y = -2.3f, z = -.023f, w = -2.0f;
176 const F32 val[10] = {1.f,2.f,3.f,.34f,.1f,-.5f,2.f,1.23f,1.234f,.89f}; 170 const F32 val[16] = {
171 1.f, 2.f, 3.f, 0.f,
172 .34f, .1f, -.5f, 0.f,
173 2.f, 1.23f, 1.234f, 0.f,
174 .89f, 0.f, 0.f, 0.f
175 };
177 LLMatrix4 mat(val); 176 LLMatrix4 mat(val);
178 LLVector4 vec4(x,y,z,w),vec4a; 177 LLVector4 vec4(x,y,z,w),vec4a;
179 vec4.rotVec(mat); 178 vec4.rotVec(mat);
@@ -187,8 +186,6 @@ namespace tut
187 vec4c.setVec(a, b, c, d); 186 vec4c.setVec(a, b, c, d);
188 vec4c.rotVec(q); 187 vec4c.rotVec(q);
189 ensure_equals("2:rotVec: Fail " ,vec4b, vec4c); 188 ensure_equals("2:rotVec: Fail " ,vec4b, vec4c);
190#endif
191#endif
192 } 189 }
193 190
194 template<> template<> 191 template<> template<>