Bug 943999 - Build toolkit/components/ctypes/test in unified mode; r=bsmedberg
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 03 Dec 2013 15:48:12 -0500
changeset 174301 e5d7b3be4516bdabaaf3e863e3206f0ab17974fa
parent 174300 2fbd41f11ba62de9d59d8b7f126259daa7e24b51
child 174302 d21baae37496ba96747266f4129c7ba15872d94c
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs943999
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 943999 - Build toolkit/components/ctypes/test in unified mode; r=bsmedberg
toolkit/components/ctypes/tests/jsctypes-test-finalizer.cpp
toolkit/components/ctypes/tests/jsctypes-test-finalizer.h
toolkit/components/ctypes/tests/jsctypes-test.cpp
toolkit/components/ctypes/tests/jsctypes-test.h
toolkit/components/ctypes/tests/moz.build
toolkit/components/ctypes/tests/unit/test_finalizer.js
toolkit/components/ctypes/tests/unit/test_jsctypes.js.in
--- a/toolkit/components/ctypes/tests/jsctypes-test-finalizer.cpp
+++ b/toolkit/components/ctypes/tests/jsctypes-test-finalizer.cpp
@@ -71,24 +71,24 @@ size_t
 test_finalizer_rel_size_t_return_size_t(size_t i)
 {
   if (-- gFinalizerTestResources[i] < 0) {
     MOZ_CRASH("Assertion failed");
   }
   return i;
 }
 
-RECT
+myRECT
 test_finalizer_rel_size_t_return_struct_t(size_t i)
 {
   if (-- gFinalizerTestResources[i] < 0) {
     MOZ_CRASH("Assertion failed");
   }
   const int32_t narrowed = (int32_t)i;
-  RECT result = { narrowed, narrowed, narrowed, narrowed };
+  myRECT result = { narrowed, narrowed, narrowed, narrowed };
   return result;
 }
 
 bool
 test_finalizer_cmp_size_t(size_t a, size_t b)
 {
   return a==b;
 }
@@ -262,50 +262,50 @@ test_finalizer_string_resource_is_acquir
 }
 
 bool
 test_finalizer_cmp_string_t(char *a, char *b)
 {
   return !strncmp(a, b, 10);
 }
 
-// Resource type: RECT
+// Resource type: myRECT
 
 // Acquire resource i
-RECT
+myRECT
 test_finalizer_acq_struct_t(int i)
 {
   gFinalizerTestResources[i] = 1;
-  RECT result = { i, i, i, i };
+  myRECT result = { i, i, i, i };
   return result;
 }
 
 // Release resource i
 void
-test_finalizer_rel_struct_t(RECT i)
+test_finalizer_rel_struct_t(myRECT i)
 {
   int index = i.top;
   if (index < 0 || index >= (int)gFinalizerTestSize) {
     MOZ_CRASH("Assertion failed");
   }
   gFinalizerTestResources[index] --;
 }
 
 bool
-test_finalizer_struct_resource_is_acquired(RECT i)
+test_finalizer_struct_resource_is_acquired(myRECT i)
 {
   int index = i.top;
   if (index < 0 || index >= (int)gFinalizerTestSize) {
     MOZ_CRASH("Assertion failed");
   }
   return gFinalizerTestResources[index] == 1;
 }
 
 bool
-test_finalizer_cmp_struct_t(RECT a, RECT b)
+test_finalizer_cmp_struct_t(myRECT a, myRECT b)
 {
   return a.top == b.top;
 }
 
 // Support for checking that we reject nullptr finalizer
 afun* test_finalizer_rel_null_function()
 {
   return nullptr;
--- a/toolkit/components/ctypes/tests/jsctypes-test-finalizer.h
+++ b/toolkit/components/ctypes/tests/jsctypes-test-finalizer.h
@@ -8,17 +8,17 @@ NS_EXTERN_C
 {
   EXPORT_CDECL(void) test_finalizer_start(size_t size);
   EXPORT_CDECL(void) test_finalizer_stop();
   EXPORT_CDECL(bool) test_finalizer_resource_is_acquired(size_t i);
 
   EXPORT_CDECL(size_t) test_finalizer_acq_size_t(size_t i);
   EXPORT_CDECL(void) test_finalizer_rel_size_t(size_t i);
   EXPORT_CDECL(size_t) test_finalizer_rel_size_t_return_size_t(size_t i);
-  EXPORT_CDECL(RECT) test_finalizer_rel_size_t_return_struct_t(size_t i);
+  EXPORT_CDECL(myRECT) test_finalizer_rel_size_t_return_struct_t(size_t i);
   EXPORT_CDECL(bool) test_finalizer_cmp_size_t(size_t a, size_t b);
 
   EXPORT_CDECL(int32_t) test_finalizer_acq_int32_t(size_t i);
   EXPORT_CDECL(void) test_finalizer_rel_int32_t(int32_t i);
   EXPORT_CDECL(bool) test_finalizer_cmp_int32_t(int32_t a, int32_t b);
 
   EXPORT_CDECL(int64_t) test_finalizer_acq_int64_t(size_t i);
   EXPORT_CDECL(void) test_finalizer_rel_int64_t(int64_t i);
@@ -36,19 +36,19 @@ NS_EXTERN_C
   EXPORT_CDECL(void) test_finalizer_rel_string_t(char *i);
   EXPORT_CDECL(bool) test_finalizer_cmp_string_t(char *a, char *b);
 
   EXPORT_CDECL(void*) test_finalizer_acq_null_t(size_t i);
   EXPORT_CDECL(void) test_finalizer_rel_null_t(void *i);
   EXPORT_CDECL(bool) test_finalizer_cmp_null_t(void *a, void *b);
   EXPORT_CDECL(bool) test_finalizer_null_resource_is_acquired(size_t i);
 
-  EXPORT_CDECL(RECT) test_finalizer_acq_struct_t(int i);
-  EXPORT_CDECL(void) test_finalizer_rel_struct_t(RECT i);
-  EXPORT_CDECL(bool) test_finalizer_cmp_struct_t(RECT a, RECT b);
+  EXPORT_CDECL(myRECT) test_finalizer_acq_struct_t(int i);
+  EXPORT_CDECL(void) test_finalizer_rel_struct_t(myRECT i);
+  EXPORT_CDECL(bool) test_finalizer_cmp_struct_t(myRECT a, myRECT b);
 
   typedef void (*afun)(size_t);
   EXPORT_CDECL(afun*) test_finalizer_rel_null_function();
 
   EXPORT_CDECL(void) test_finalizer_rel_size_t_set_errno(size_t i);
   EXPORT_CDECL(void) reset_errno();
 
 }
--- a/toolkit/components/ctypes/tests/jsctypes-test.cpp
+++ b/toolkit/components/ctypes/tests/jsctypes-test.cpp
@@ -165,120 +165,120 @@ test_wide_ret()
 
 char *
 test_ansi_echo(const char* string)
 {
   return (char*)string;
 }
 
 int32_t
-test_pt_in_rect(RECT rc, POINT pt)
+test_pt_in_rect(myRECT rc, myPOINT pt)
 {
   if (pt.x < rc.left || pt.x > rc.right)
     return 0;
   if (pt.y < rc.bottom || pt.y > rc.top)
     return 0;
   return 1;
 }
 
 void
-test_init_pt(POINT* pt, int32_t x, int32_t y)
+test_init_pt(myPOINT* pt, int32_t x, int32_t y)
 {
   pt->x = x;
   pt->y = y;
 }
 
 int32_t
 test_nested_struct(NESTED n)
 {
   return int32_t(n.n1 + n.n2 + n.inner.i1 + n.inner.i2 + n.inner.i3 + n.n3 + n.n4);
 }
 
-POINT
-test_struct_return(RECT r)
+myPOINT
+test_struct_return(myRECT r)
 {
-  POINT p;
+  myPOINT p;
   p.x = r.left; p.y = r.top;
   return p;
 }
 
-RECT
-test_large_struct_return(RECT a, RECT b)
+myRECT
+test_large_struct_return(myRECT a, myRECT b)
 {
-  RECT r;
+  myRECT r;
   r.left = a.left; r.right = a.right;
   r.top = b.top; r.bottom = b.bottom;
   return r;
 }
 
 ONE_BYTE
-test_1_byte_struct_return(RECT r)
+test_1_byte_struct_return(myRECT r)
 {
   ONE_BYTE s;
   s.a = r.top;
   return s;
 }
 
 TWO_BYTE
-test_2_byte_struct_return(RECT r)
+test_2_byte_struct_return(myRECT r)
 {
   TWO_BYTE s;
   s.a = r.top;
   s.b = r.left;
   return s;
 }
 
 THREE_BYTE
-test_3_byte_struct_return(RECT r)
+test_3_byte_struct_return(myRECT r)
 {
   THREE_BYTE s;
   s.a = r.top;
   s.b = r.left;
   s.c = r.bottom;
   return s;
 }
 
 FOUR_BYTE
-test_4_byte_struct_return(RECT r)
+test_4_byte_struct_return(myRECT r)
 {
   FOUR_BYTE s;
   s.a = r.top;
   s.b = r.left;
   s.c = r.bottom;
   s.d = r.right;
   return s;
 }
 
 FIVE_BYTE
-test_5_byte_struct_return(RECT r)
+test_5_byte_struct_return(myRECT r)
 {
   FIVE_BYTE s;
   s.a = r.top;
   s.b = r.left;
   s.c = r.bottom;
   s.d = r.right;
   s.e = r.top;
   return s;
 }
 
 SIX_BYTE
-test_6_byte_struct_return(RECT r)
+test_6_byte_struct_return(myRECT r)
 {
   SIX_BYTE s;
   s.a = r.top;
   s.b = r.left;
   s.c = r.bottom;
   s.d = r.right;
   s.e = r.top;
   s.f = r.left;
   return s;
 }
 
 SEVEN_BYTE
-test_7_byte_struct_return(RECT r)
+test_7_byte_struct_return(myRECT r)
 {
   SEVEN_BYTE s;
   s.a = r.top;
   s.b = r.left;
   s.c = r.bottom;
   s.d = r.right;
   s.e = r.top;
   s.f = r.left;
@@ -367,9 +367,9 @@ test_vector_add_va_cdecl(uint8_t num_vec
     int32_t* vec = va_arg(list, int32_t*);
     for (uint8_t j = 0; j < vec_len; ++j)
       result[j] += vec[j];
   }
   va_end(list);
   return result;
 }
 
-RECT data_rect = { -1, -2, 3, 4 };
+myRECT data_rect = { -1, -2, 3, 4 };
--- a/toolkit/components/ctypes/tests/jsctypes-test.h
+++ b/toolkit/components/ctypes/tests/jsctypes-test.h
@@ -1,13 +1,16 @@
 /* -*-  Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#ifndef jsctypes_test_h
+#define jsctypes_test_h
+
 #include "nscore.h"
 #include "jspubtd.h"
 
 #define EXPORT_CDECL(type)   NS_EXPORT type
 #define EXPORT_STDCALL(type) NS_EXPORT type NS_STDCALL
 
 NS_EXTERN_C
 {
@@ -105,22 +108,22 @@ NS_EXTERN_C
     char b;
     char c;
     char d;
     char e;
     char f;
     char g;
   };
 
-  struct POINT {
+  struct myPOINT {
     int32_t x;
     int32_t y;
   };
 
-  struct RECT {
+  struct myRECT {
     int32_t top;
     int32_t left;
     int32_t bottom;
     int32_t right;
   };
 
   struct INNER {
     uint8_t i1;
@@ -131,29 +134,29 @@ NS_EXTERN_C
   struct NESTED {
     int32_t n1;
     int16_t n2;
     INNER   inner;
     int64_t n3;
     int32_t n4;
   };
 
-  NS_EXPORT int32_t test_pt_in_rect(RECT, POINT);
-  NS_EXPORT void test_init_pt(POINT* pt, int32_t x, int32_t y);
+  NS_EXPORT int32_t test_pt_in_rect(myRECT, myPOINT);
+  NS_EXPORT void test_init_pt(myPOINT* pt, int32_t x, int32_t y);
 
   NS_EXPORT int32_t test_nested_struct(NESTED);
-  NS_EXPORT POINT test_struct_return(RECT);
-  NS_EXPORT RECT test_large_struct_return(RECT, RECT);
-  NS_EXPORT ONE_BYTE test_1_byte_struct_return(RECT);
-  NS_EXPORT TWO_BYTE test_2_byte_struct_return(RECT);
-  NS_EXPORT THREE_BYTE test_3_byte_struct_return(RECT);
-  NS_EXPORT FOUR_BYTE test_4_byte_struct_return(RECT);
-  NS_EXPORT FIVE_BYTE test_5_byte_struct_return(RECT);
-  NS_EXPORT SIX_BYTE test_6_byte_struct_return(RECT);
-  NS_EXPORT SEVEN_BYTE test_7_byte_struct_return(RECT);
+  NS_EXPORT myPOINT test_struct_return(myRECT);
+  NS_EXPORT myRECT test_large_struct_return(myRECT, myRECT);
+  NS_EXPORT ONE_BYTE test_1_byte_struct_return(myRECT);
+  NS_EXPORT TWO_BYTE test_2_byte_struct_return(myRECT);
+  NS_EXPORT THREE_BYTE test_3_byte_struct_return(myRECT);
+  NS_EXPORT FOUR_BYTE test_4_byte_struct_return(myRECT);
+  NS_EXPORT FIVE_BYTE test_5_byte_struct_return(myRECT);
+  NS_EXPORT SIX_BYTE test_6_byte_struct_return(myRECT);
+  NS_EXPORT SEVEN_BYTE test_7_byte_struct_return(myRECT);
 
   NS_EXPORT void * test_fnptr();
 
   typedef int32_t (* test_func_ptr)(int8_t);
   NS_EXPORT int32_t test_closure_cdecl(int8_t, test_func_ptr);
 #if defined(_WIN32)
   typedef int32_t (NS_STDCALL * test_func_ptr_stdcall)(int8_t);
   NS_EXPORT int32_t test_closure_stdcall(int8_t, test_func_ptr_stdcall);
@@ -164,10 +167,12 @@ NS_EXTERN_C
 
   EXPORT_CDECL(int32_t) test_sum_va_cdecl(uint8_t n, ...);
   EXPORT_CDECL(uint8_t) test_count_true_va_cdecl(uint8_t n, ...);
   EXPORT_CDECL(void) test_add_char_short_int_va_cdecl(uint32_t* result, ...);
   EXPORT_CDECL(int32_t*) test_vector_add_va_cdecl(uint8_t num_vecs,
                                                   uint8_t vec_len,
                                                   int32_t* result, ...);
 
-  NS_EXPORT extern RECT data_rect;
+  NS_EXPORT extern myRECT data_rect;
 }
+
+#endif
--- a/toolkit/components/ctypes/tests/moz.build
+++ b/toolkit/components/ctypes/tests/moz.build
@@ -2,17 +2,17 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 NO_DIST_INSTALL = True
 
 XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'jsctypes-test-errno.cpp',
     'jsctypes-test-finalizer.cpp',
     'jsctypes-test.cpp',
 ]
 
 LIBRARY_NAME = 'jsctypes-test'
 
 FORCE_SHARED_LIB = True
--- a/toolkit/components/ctypes/tests/unit/test_finalizer.js
+++ b/toolkit/components/ctypes/tests/unit/test_finalizer.js
@@ -131,17 +131,17 @@ function run_test()
                                ctypes.default_abi,
                                ctypes.bool,
                                ctypes.char.ptr,
                                ctypes.char.ptr),
       status: status,
       released: released
     }
   );
-  const rect_t = new ctypes.StructType("RECT",
+  const rect_t = new ctypes.StructType("myRECT",
                                        [{ top   : ctypes.int32_t },
                                         { left  : ctypes.int32_t },
                                         { bottom: ctypes.int32_t },
                                         { right : ctypes.int32_t }]);
   samples.push(
     {
       name: "struct",
       acquire: library.declare("test_finalizer_acq_struct_t",
@@ -180,17 +180,17 @@ function run_test()
       status: status,
       released: function released_eq(i, witness) {
         return i == witness;
       }
     }
   );
   samples.push(
     {
-      name: "size_t, release returns RECT",
+      name: "size_t, release returns myRECT",
       acquire: library.declare("test_finalizer_acq_size_t",
                            ctypes.default_abi,
                            ctypes.size_t,
                            ctypes.size_t),
       release: library.declare("test_finalizer_rel_size_t_return_struct_t",
                                ctypes.default_abi,
                                rect_t,
                                ctypes.size_t),
--- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in
+++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in
@@ -2423,20 +2423,20 @@ function run_readstring_tests(library) {
   let utf8_cesu8_result = utf8_cesu8_string.readStringReplaceMalformed();
   do_check_eq(0xD801, utf8_cesu8_result.charCodeAt(0));
   do_check_eq(0xDC00, utf8_cesu8_result.charCodeAt(1));
   do_check_eq(0xFFFD, utf8_cesu8_result.charCodeAt(2));
   do_check_eq(0xFFFD, utf8_cesu8_result.charCodeAt(3));
 }
 
 function run_struct_tests(library) {
-  const point_t = new ctypes.StructType("POINT",
+  const point_t = new ctypes.StructType("myPOINT",
                        [{ x: ctypes.int32_t },
                         { y: ctypes.int32_t }]);
-  const rect_t = new ctypes.StructType("RECT",
+  const rect_t = new ctypes.StructType("myRECT",
                        [{ top   : ctypes.int32_t },
                         { left  : ctypes.int32_t },
                         { bottom: ctypes.int32_t },
                         { right : ctypes.int32_t }]);
 
   let test_pt_in_rect = library.declare("test_pt_in_rect", ctypes.default_abi, ctypes.int32_t, rect_t, point_t);
   let rect = new rect_t(10, 5, 5, 10);
   let pt1 = new point_t(6, 6);
@@ -2734,17 +2734,17 @@ function run_variadic_tests(library) {
                                            [ctypes.uint8_t]).ptr;
   do_check_throws(function() {
     sum_va_type().value = sum_notva_type();
   }, TypeError);
 }
 
 function run_static_data_tests(library)
 {
-  const rect_t = new ctypes.StructType("RECT",
+  const rect_t = new ctypes.StructType("myRECT",
                        [{ top   : ctypes.int32_t },
                         { left  : ctypes.int32_t },
                         { bottom: ctypes.int32_t },
                         { right : ctypes.int32_t }]);
 
   let data_rect = library.declare("data_rect", rect_t);
 
   // Test reading static data.