OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
3 * Use of this source code is governed by a BSD-style license that can be | |
4 * found in the LICENSE file. | |
5 */ | |
6 | |
7 // This file tests for the presence of libraries and .o files in the SDK | |
8 // it does not actually execute any of the library code. | |
9 | |
10 | |
11 #include "libs_present_stub.h" | |
12 | |
13 // This list should include all exported header files (directly or indirectly) | |
14 // to ensure they were properly included in the SDK. | |
15 #include <math.h> | |
16 #include <pthread.h> | |
17 #include <stdio.h> | |
18 #include <unistd.h> | |
19 #include <iostream> | |
20 #include <nacl/nacl_imc.h> | |
21 #include <nacl/nacl_srpc.h> | |
22 | |
23 | |
24 // Dummy variables used to hold return values. | |
25 bool bool_value; | |
26 double double_value; | |
27 pthread_t pthread_t_value; | |
28 const char* char_ptr_value; | |
29 char char_array_value[128]; | |
30 | |
31 static void TestLibsPresent() { | |
32 // This code should invoke one method from each exported library to | |
33 // ensure the library was built correctly. | |
34 | |
35 // Test that libm is present. | |
36 if (run_tests) | |
37 double_value = sin(0.0); | |
38 | |
39 // Test that libimc is present. | |
40 if (run_tests) | |
41 nacl::Close(nacl::kInvalidHandle); | |
42 | |
43 // Test that libpthread is present. | |
44 if (run_tests) | |
45 pthread_t_value = pthread_self(); | |
46 | |
47 // Test that libsrpc is present. | |
48 if (run_tests) | |
49 char_ptr_value = NaClSrpcErrorString(NACL_SRPC_RESULT_OK); | |
50 | |
51 // Test that libunimpl is present. | |
52 if (run_tests) | |
53 char_ptr_value = getcwd(char_array_value, sizeof(char_array_value)); | |
54 } | |
55 | |
56 int main(int argc, char **argv) { | |
57 // EH tests that libsupc++ is present. | |
58 try { | |
59 TestLibsPresent(); | |
60 } catch(...) { | |
61 // iotream tests that libstdc++ is present. | |
62 std::cout << "FAIL" << std::endl; | |
63 return 1; | |
64 } | |
65 // printf tests that libc is present. | |
66 printf("PASS\n"); | |
67 return 0; | |
68 } | |
OLD | NEW |