aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2011-01-17 15:36:26 -0800
committerAlon Zakai <azakai@mozilla.com>2011-01-17 15:36:26 -0800
commit1f3de5c76e4947afccca350da24859e52f6aa83f (patch)
tree1539bbf09d9a3b71e06db5444d4ea5ceb43f8013
parent13a520ed493d40e405045df1829863edfdb2308e (diff)
libcxx test; support for linking in test runner; failure in clang_0_1.test_libcxx
-rwxr-xr-xemscripten.py8
-rw-r--r--tests/libcxx/LICENSE.txt76
-rw-r--r--tests/libcxx/hash.cpp559
-rw-r--r--tests/libcxx/include/__bit_reference1225
-rw-r--r--tests/libcxx/include/__config263
-rw-r--r--tests/libcxx/include/__functional_032128
-rw-r--r--tests/libcxx/include/__functional_base534
-rw-r--r--tests/libcxx/include/__functional_base_031087
-rw-r--r--tests/libcxx/include/__hash_table1819
-rw-r--r--tests/libcxx/include/__locale1376
-rw-r--r--tests/libcxx/include/__mutex_base437
-rw-r--r--tests/libcxx/include/__split_buffer617
-rw-r--r--tests/libcxx/include/__sso_allocator75
-rw-r--r--tests/libcxx/include/__std_stream313
-rw-r--r--tests/libcxx/include/__tree2238
-rw-r--r--tests/libcxx/include/__tuple267
-rw-r--r--tests/libcxx/include/__tuple_0325
-rw-r--r--tests/libcxx/include/algorithm5331
-rw-r--r--tests/libcxx/include/array313
-rw-r--r--tests/libcxx/include/atomic1507
-rw-r--r--tests/libcxx/include/bitset1029
-rw-r--r--tests/libcxx/include/cassert23
-rw-r--r--tests/libcxx/include/ccomplex27
-rw-r--r--tests/libcxx/include/cctype159
-rw-r--r--tests/libcxx/include/cerrno57
-rw-r--r--tests/libcxx/include/cfenv80
-rw-r--r--tests/libcxx/include/cfloat76
-rw-r--r--tests/libcxx/include/chrono871
-rw-r--r--tests/libcxx/include/cinttypes257
-rw-r--r--tests/libcxx/include/ciso64623
-rw-r--r--tests/libcxx/include/climits46
-rw-r--r--tests/libcxx/include/clocale51
-rw-r--r--tests/libcxx/include/cmath1584
-rw-r--r--tests/libcxx/include/codecvt545
-rw-r--r--tests/libcxx/include/complex1514
-rw-r--r--tests/libcxx/include/complex.h33
-rw-r--r--tests/libcxx/include/condition_variable254
-rw-r--r--tests/libcxx/include/csetjmp50
-rw-r--r--tests/libcxx/include/csignal56
-rw-r--r--tests/libcxx/include/cstdarg46
-rw-r--r--tests/libcxx/include/cstdbool30
-rw-r--r--tests/libcxx/include/cstddef95
-rw-r--r--tests/libcxx/include/cstdint189
-rw-r--r--tests/libcxx/include/cstdio159
-rw-r--r--tests/libcxx/include/cstdlib138
-rw-r--r--tests/libcxx/include/cstring109
-rw-r--r--tests/libcxx/include/ctgmath27
-rw-r--r--tests/libcxx/include/ctime70
-rw-r--r--tests/libcxx/include/cwchar195
-rw-r--r--tests/libcxx/include/cwctype211
-rw-r--r--tests/libcxx/include/deque2774
-rw-r--r--tests/libcxx/include/exception246
-rw-r--r--tests/libcxx/include/ext/.svn/all-wcprops17
-rw-r--r--tests/libcxx/include/ext/.svn/entries96
-rw-r--r--tests/libcxx/include/ext/.svn/text-base/hash_map.svn-base986
-rw-r--r--tests/libcxx/include/ext/.svn/text-base/hash_set.svn-base650
-rw-r--r--tests/libcxx/include/ext/hash_map986
-rw-r--r--tests/libcxx/include/ext/hash_set650
-rw-r--r--tests/libcxx/include/forward_list1526
-rw-r--r--tests/libcxx/include/fstream1394
-rw-r--r--tests/libcxx/include/functional1946
-rw-r--r--tests/libcxx/include/future2313
-rw-r--r--tests/libcxx/include/initializer_list99
-rw-r--r--tests/libcxx/include/iomanip502
-rw-r--r--tests/libcxx/include/ios985
-rw-r--r--tests/libcxx/include/iosfwd191
-rw-r--r--tests/libcxx/include/iostream58
-rw-r--r--tests/libcxx/include/istream1735
-rw-r--r--tests/libcxx/include/iterator1707
-rw-r--r--tests/libcxx/include/limits613
-rw-r--r--tests/libcxx/include/list1605
-rw-r--r--tests/libcxx/include/locale4302
-rw-r--r--tests/libcxx/include/map1830
-rw-r--r--tests/libcxx/include/memory3854
-rw-r--r--tests/libcxx/include/mutex523
-rw-r--r--tests/libcxx/include/new108
-rw-r--r--tests/libcxx/include/numeric195
-rw-r--r--tests/libcxx/include/ostream1291
-rw-r--r--tests/libcxx/include/queue662
-rw-r--r--tests/libcxx/include/random6564
-rw-r--r--tests/libcxx/include/ratio441
-rw-r--r--tests/libcxx/include/regex6358
-rw-r--r--tests/libcxx/include/scoped_allocator573
-rw-r--r--tests/libcxx/include/set942
-rw-r--r--tests/libcxx/include/sstream884
-rw-r--r--tests/libcxx/include/stack259
-rw-r--r--tests/libcxx/include/stdexcept160
-rw-r--r--tests/libcxx/include/streambuf562
-rw-r--r--tests/libcxx/include/string3781
-rw-r--r--tests/libcxx/include/strstream359
-rw-r--r--tests/libcxx/include/system_error633
-rw-r--r--tests/libcxx/include/tgmath.h27
-rw-r--r--tests/libcxx/include/thread422
-rw-r--r--tests/libcxx/include/tuple906
-rw-r--r--tests/libcxx/include/type_traits2318
-rw-r--r--tests/libcxx/include/typeindex94
-rw-r--r--tests/libcxx/include/typeinfo122
-rw-r--r--tests/libcxx/include/unordered_map1678
-rw-r--r--tests/libcxx/include/unordered_set1046
-rw-r--r--tests/libcxx/include/utility505
-rw-r--r--tests/libcxx/include/valarray4742
-rw-r--r--tests/libcxx/include/vector2786
-rw-r--r--tests/libcxx/main.cpp45
-rw-r--r--tests/libcxx/readme.txt4
-rw-r--r--tests/runner.py52
105 files changed, 98290 insertions, 19 deletions
diff --git a/emscripten.py b/emscripten.py
index 7a92455c..8b4d5e60 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -13,10 +13,14 @@ COMPILER = path_from_root('src', 'compiler.js')
def emscripten(filename, settings):
data = open(filename, 'r').read()
- cwd = os.getcwd()
+ try:
+ cwd = os.getcwd()
+ except:
+ cwd = None
os.chdir(os.path.dirname(COMPILER))
subprocess.Popen(JS_ENGINE + [COMPILER], stdin=subprocess.PIPE).communicate(settings+'\n'+data)[0]
- os.chdir(cwd)
+ if cwd is not None:
+ os.chdir(cwd)
if __name__ == '__main__':
if sys.argv.__len__() not in [2,3,4]:
diff --git a/tests/libcxx/LICENSE.txt b/tests/libcxx/LICENSE.txt
new file mode 100644
index 00000000..926f0676
--- /dev/null
+++ b/tests/libcxx/LICENSE.txt
@@ -0,0 +1,76 @@
+==============================================================================
+libc++ License
+==============================================================================
+
+The libc++ library is dual licensed under both the University of Illinois
+"BSD-Like" license and the MIT license. As a user of this code you may choose
+to use it under either license. As a contributor, you agree to allow your code
+to be used under both.
+
+Full text of the relevant licenses is included below.
+
+==============================================================================
+
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+
+Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/tests/libcxx/hash.cpp b/tests/libcxx/hash.cpp
new file mode 100644
index 00000000..728b9bd3
--- /dev/null
+++ b/tests/libcxx/hash.cpp
@@ -0,0 +1,559 @@
+//===-------------------------- hash.cpp ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "__hash_table"
+#include "algorithm"
+#include "stdexcept"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace {
+
+// handle all next_prime(i) for i in [1, 210), special case 0
+const unsigned small_primes[] =
+{
+ 0,
+ 2,
+ 3,
+ 5,
+ 7,
+ 11,
+ 13,
+ 17,
+ 19,
+ 23,
+ 29,
+ 31,
+ 37,
+ 41,
+ 43,
+ 47,
+ 53,
+ 59,
+ 61,
+ 67,
+ 71,
+ 73,
+ 79,
+ 83,
+ 89,
+ 97,
+ 101,
+ 103,
+ 107,
+ 109,
+ 113,
+ 127,
+ 131,
+ 137,
+ 139,
+ 149,
+ 151,
+ 157,
+ 163,
+ 167,
+ 173,
+ 179,
+ 181,
+ 191,
+ 193,
+ 197,
+ 199,
+ 211
+};
+
+// potential primes = 210*k + indices[i], k >= 1
+// these numbers are not divisible by 2, 3, 5 or 7
+// (or any integer 2 <= j <= 10 for that matter).
+const unsigned indices[] =
+{
+ 1,
+ 11,
+ 13,
+ 17,
+ 19,
+ 23,
+ 29,
+ 31,
+ 37,
+ 41,
+ 43,
+ 47,
+ 53,
+ 59,
+ 61,
+ 67,
+ 71,
+ 73,
+ 79,
+ 83,
+ 89,
+ 97,
+ 101,
+ 103,
+ 107,
+ 109,
+ 113,
+ 121,
+ 127,
+ 131,
+ 137,
+ 139,
+ 143,
+ 149,
+ 151,
+ 157,
+ 163,
+ 167,
+ 169,
+ 173,
+ 179,
+ 181,
+ 187,
+ 191,
+ 193,
+ 197,
+ 199,
+ 209
+};
+
+}
+
+// Returns: If n == 0, returns 0. Else returns the lowest prime number that
+// is greater than or equal to n.
+//
+// The algorithm creates a list of small primes, plus an open-ended list of
+// potential primes. All prime numbers are potential prime numbers. However
+// some potential prime numbers are not prime. In an ideal world, all potential
+// prime numbers would be prime. Candiate prime numbers are chosen as the next
+// highest potential prime. Then this number is tested for prime by dividing it
+// by all potential prime numbers less than the sqrt of the candidate.
+//
+// This implementation defines potential primes as those numbers not divisible
+// by 2, 3, 5, and 7. Other (common) implementations define potential primes
+// as those not divisible by 2. A few other implementations define potential
+// primes as those not divisible by 2 or 3. By raising the number of small
+// primes which the potential prime is not divisible by, the set of potential
+// primes more closely approximates the set of prime numbers. And thus there
+// are fewer potential primes to search, and fewer potential primes to divide
+// against.
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__check_for_overflow(size_t N, integral_constant<size_t, 32>)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (N > 0xFFFFFFFB)
+ throw overflow_error("__next_prime overflow");
+#endif
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void
+__check_for_overflow(size_t N, integral_constant<size_t, 64>)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (N > 0xFFFFFFFFFFFFFFC5ull)
+ throw overflow_error("__next_prime overflow");
+#endif
+}
+
+size_t
+__next_prime(size_t n)
+{
+ const size_t L = 210;
+ const size_t N = sizeof(small_primes) / sizeof(small_primes[0]);
+ // If n is small enough, search in small_primes
+ if (n <= small_primes[N-1])
+ return *std::lower_bound(small_primes, small_primes + N, n);
+ // Else n > largest small_primes
+ // Check for overflow
+ __check_for_overflow(n, integral_constant<size_t,
+ sizeof(n) * __CHAR_BIT__>());
+ // Start searching list of potential primes: L * k0 + indices[in]
+ const size_t M = sizeof(indices) / sizeof(indices[0]);
+ // Select first potential prime >= n
+ // Known a-priori n >= L
+ size_t k0 = n / L;
+ size_t in = std::lower_bound(indices, indices + M, n - k0 * L) - indices;
+ n = L * k0 + indices[in];
+ while (true)
+ {
+ // Divide n by all primes or potential primes (i) until:
+ // 1. The division is even, so try next potential prime.
+ // 2. The i > sqrt(n), in which case n is prime.
+ // It is known a-priori that n is not divisible by 2, 3, 5 or 7,
+ // so don't test those (j == 5