You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2011/03/08 23:01:29 UTC

svn commit: r1079562 - in /apr/apr/trunk/test: Makefile.in abts_tests.h testlfsabi.c testlfsabi.h testlfsabi32.c testlfsabi64.c testlfsabi_include.c testutil.h

Author: sf
Date: Tue Mar  8 22:01:29 2011
New Revision: 1079562

URL: http://svn.apache.org/viewvc?rev=1079562&view=rev
Log:
Add a test that checks that various apr types don't change their size
if an apr consumer specifies -D_FILE_OFFSET_BITS=64 or 32.

Added:
    apr/apr/trunk/test/testlfsabi.c   (with props)
    apr/apr/trunk/test/testlfsabi.h   (with props)
    apr/apr/trunk/test/testlfsabi32.c   (with props)
    apr/apr/trunk/test/testlfsabi64.c   (with props)
    apr/apr/trunk/test/testlfsabi_include.c   (with props)
Modified:
    apr/apr/trunk/test/Makefile.in
    apr/apr/trunk/test/abts_tests.h
    apr/apr/trunk/test/testutil.h

Modified: apr/apr/trunk/test/Makefile.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/Makefile.in?rev=1079562&r1=1079561&r2=1079562&view=diff
==============================================================================
--- apr/apr/trunk/test/Makefile.in (original)
+++ apr/apr/trunk/test/Makefile.in Tue Mar  8 22:01:29 2011
@@ -34,7 +34,8 @@ TESTS = testtime.lo teststr.lo testvsn.l
 	testxlate.lo testdbd.lo testrmm.lo testldap.lo testmd4.lo	\
 	teststrmatch.lo testpass.lo testcrypto.lo testqueue.lo		\
 	testbuckets.lo testxml.lo testdbm.lo testuuid.lo testmd5.lo	\
-	testreslist.lo testbase64.lo testhooks.lo
+	testreslist.lo testbase64.lo testhooks.lo testlfsabi.lo         \
+	testlfsabi32.lo testlfsabi64.lo
 
 OTHER_PROGRAMS = \
 	sendfile@EXEEXT@ \

Modified: apr/apr/trunk/test/abts_tests.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/abts_tests.h?rev=1079562&r1=1079561&r2=1079562&view=diff
==============================================================================
--- apr/apr/trunk/test/abts_tests.h (original)
+++ apr/apr/trunk/test/abts_tests.h Tue Mar  8 22:01:29 2011
@@ -86,7 +86,8 @@ const struct testlist {
     {testrmm},
     {testdbm},
     {testqueue},
-    {testreslist}
+    {testreslist},
+    {testlfsabi}
 };
 
 #endif /* APR_TEST_INCLUDES */

Added: apr/apr/trunk/test/testlfsabi.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testlfsabi.c?rev=1079562&view=auto
==============================================================================
--- apr/apr/trunk/test/testlfsabi.c (added)
+++ apr/apr/trunk/test/testlfsabi.c Tue Mar  8 22:01:29 2011
@@ -0,0 +1,60 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "testutil.h"
+#include "testlfsabi.h"
+#include "apr_file_info.h"
+
+/*
+ * Check that various types don't change size depending on
+ * -D_FILE_OFFSET_BITS=64
+ */
+
+extern void get_type_sizes32(int *res);
+extern void get_type_sizes64(int *res);
+
+void get_type_sizes(int *res)
+{
+#include "testlfsabi_include.c"
+}
+
+static void check_type_sizes(abts_case *tc, void *data)
+{
+    int normal[IDX_MAX], bits32[IDX_MAX], bits64[IDX_MAX];
+    get_type_sizes(normal);
+    get_type_sizes32(bits32);
+    get_type_sizes64(bits64);
+    CHECKSIZE(tc, normal, bits32, apr_dev_t);
+    CHECKSIZE(tc, normal, bits64, apr_dev_t);
+    CHECKSIZE(tc, normal, bits32, apr_ino_t);
+    CHECKSIZE(tc, normal, bits64, apr_ino_t);
+    CHECKSIZE(tc, normal, bits32, apr_off_t);
+    CHECKSIZE(tc, normal, bits64, apr_off_t);
+    CHECKSIZE(tc, normal, bits32, apr_socklen_t);
+    CHECKSIZE(tc, normal, bits64, apr_socklen_t);
+    CHECKSIZE(tc, normal, bits32, apr_size_t);
+    CHECKSIZE(tc, normal, bits64, apr_size_t);
+}
+
+abts_suite *testlfsabi(abts_suite *suite)
+{
+    suite = ADD_SUITE(suite)
+
+    abts_run_test(suite, check_type_sizes, NULL);
+
+    return suite;
+}
+

Propchange: apr/apr/trunk/test/testlfsabi.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: apr/apr/trunk/test/testlfsabi.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testlfsabi.h?rev=1079562&view=auto
==============================================================================
--- apr/apr/trunk/test/testlfsabi.h (added)
+++ apr/apr/trunk/test/testlfsabi.h Tue Mar  8 22:01:29 2011
@@ -0,0 +1,28 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "abts.h"
+
+#define IDX_apr_dev_t       0
+#define IDX_apr_ino_t       1
+#define IDX_apr_off_t       2
+#define IDX_apr_socklen_t   3
+#define IDX_apr_size_t      4
+#define IDX_MAX             5
+
+#define GETSIZE(res, type)  res[(IDX_##type)] = sizeof(type)
+#define CHECKSIZE(tc, res1, res2, type)                         \
+  ABTS_INT_EQUAL(tc, res1[(IDX_##type)], res2[(IDX_##type)]);

Propchange: apr/apr/trunk/test/testlfsabi.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: apr/apr/trunk/test/testlfsabi32.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testlfsabi32.c?rev=1079562&view=auto
==============================================================================
--- apr/apr/trunk/test/testlfsabi32.c (added)
+++ apr/apr/trunk/test/testlfsabi32.c Tue Mar  8 22:01:29 2011
@@ -0,0 +1,29 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef _FILE_OFFSET_BITS
+#undef _FILE_OFFSET_BITS
+#endif
+
+#define _FILE_OFFSET_BITS 32
+
+#include "testlfsabi.h"
+#include "apr_file_info.h"
+
+void get_type_sizes32(int *res)
+{
+#include "testlfsabi_include.c"
+}

Propchange: apr/apr/trunk/test/testlfsabi32.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: apr/apr/trunk/test/testlfsabi64.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testlfsabi64.c?rev=1079562&view=auto
==============================================================================
--- apr/apr/trunk/test/testlfsabi64.c (added)
+++ apr/apr/trunk/test/testlfsabi64.c Tue Mar  8 22:01:29 2011
@@ -0,0 +1,29 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef _FILE_OFFSET_BITS
+#undef _FILE_OFFSET_BITS
+#endif
+
+#define _FILE_OFFSET_BITS 64
+
+#include "testlfsabi.h"
+#include "apr_file_info.h"
+
+void get_type_sizes64(int *res)
+{
+#include "testlfsabi_include.c"
+}

Propchange: apr/apr/trunk/test/testlfsabi64.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: apr/apr/trunk/test/testlfsabi_include.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testlfsabi_include.c?rev=1079562&view=auto
==============================================================================
--- apr/apr/trunk/test/testlfsabi_include.c (added)
+++ apr/apr/trunk/test/testlfsabi_include.c Tue Mar  8 22:01:29 2011
@@ -0,0 +1,21 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+    GETSIZE(res, apr_dev_t);
+    GETSIZE(res, apr_ino_t);
+    GETSIZE(res, apr_off_t);
+    GETSIZE(res, apr_socklen_t);
+    GETSIZE(res, apr_size_t);

Propchange: apr/apr/trunk/test/testlfsabi_include.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: apr/apr/trunk/test/testutil.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testutil.h?rev=1079562&r1=1079561&r2=1079562&view=diff
==============================================================================
--- apr/apr/trunk/test/testutil.h (original)
+++ apr/apr/trunk/test/testutil.h Tue Mar  8 22:01:29 2011
@@ -123,5 +123,6 @@ abts_suite *testxml(abts_suite *suite);
 abts_suite *testxlate(abts_suite *suite);
 abts_suite *testrmm(abts_suite *suite);
 abts_suite *testdbm(abts_suite *suite);
+abts_suite *testlfsabi(abts_suite *suite);
 
 #endif /* APR_TEST_INCLUDES */