harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r548949 - in /harmony/enhanced/classlib/trunk/modules/portlib: build.xml src/test/native/hyerror/shared/hyerror.c src/test/native/hyerror/unix/makefile src/test/native/hyerror/windows/makefile
Date Wed, 20 Jun 2007 06:15:33 GMT
Author: tonywu
Date: Tue Jun 19 23:15:32 2007
New Revision: 548949

URL: http://svn.apache.org/viewvc?view=rev&rev=548949
Log:
Apply patch HARMONY-4233 ([classlib][portlib] Modified the hyerror test by using HyCunit)

Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/build.xml
    harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/shared/hyerror.c
    harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/unix/makefile
    harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/windows/makefile

Modified: harmony/enhanced/classlib/trunk/modules/portlib/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/build.xml?view=diff&rev=548949&r1=548948&r2=548949
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/build.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/build.xml Tue Jun 19 23:15:32 2007
@@ -179,29 +179,36 @@
         </delete>
     </target>
 
-    <target name="-compile-native-tests" if="test.portlib" >
+    <target name="-compile-native-tests" >
         <make dir="${hy.portlib.src.test.native}/init/${hy.os.family}" />
         <make dir="${hy.portlib.src.test.native}/hyerror/${hy.os.family}" />
         <make dir="${hy.portlib.src.test.native}/hytime/${hy.os.family}" />
         <make dir="${hy.portlib.src.test.native}/hyfile/${hy.os.family}" />
     </target>
 
-    <target name="-run-native-tests" if="test.portlib" >
+    <target name="-run-native-tests" >
         <mkdir dir="${hy.tests.reports}" />
         <property environment="env"/>
         <condition property="hy.thr.libpath"
                    value="${path.separator}${hy.jdk}/jre/bin/default" else="">
             <equals arg1="${hy.no.thr}" arg2="true" />
         </condition>
-        <exec-native test="init" />
+        <!-- <exec-native test="init" /> -->
         <exec-native test="hyerror" />
-        <exec-native test="hytime" />
-        <exec-native test="hyfile" />
+        <!-- <exec-native test="hytime" /> -->
+        <!-- <exec-native test="hyfile" /> -->
+        <!-- <exec-native test="hystr" /> -->
+	
+        <move todir="${hy.tests.reports}">
+            <fileset dir="${hy.portlib}">
+                <include name="TEST-*.xml"/>
+            </fileset>
+        </move>
 
         <antcall target="touch-errors-file" />
     </target>
 
-    <target name="-clean-native-tests" if="test.portlib" >
+    <target name="-clean-native-tests" >
         <make dir="${hy.portlib.src.test.native}/init/${hy.os.family}" 
               target="clean" />
         <make dir="${hy.portlib.src.test.native}/hyerror/${hy.os.family}" 
@@ -245,14 +252,14 @@
                 </not>
             </condition>
             <echo>@{test}: ${@{test}.result}${line.separator}</echo>
-            <echo file="${hy.tests.reports}/TEST-${@{test}.name}.xml"
+<!--            <echo file="${hy.tests.reports}/TEST-${@{test}.name}.xml"
                  >&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
 &lt;testsuite tests="1" errors='${@{test}.errorcount}' failures='0'
     name='${@{test}.name}' time='0'&gt;
   &lt;testcase classname='${@{test}.name}' name='${@{test}.name}'
        time='0.0' /&gt;
   &lt;system-out&gt;&lt;![CDATA[${@{test}.output}]]&gt;&lt;/system-out&gt;
-&lt;/testsuite&gt;${line.separator}</echo>
+&lt;/testsuite&gt;${line.separator}</echo>   -->
         </sequential>
     </macrodef>
 

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/shared/hyerror.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/shared/hyerror.c?view=diff&rev=548949&r1=548948&r2=548949
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/shared/hyerror.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/shared/hyerror.c
Tue Jun 19 23:15:32 2007
@@ -16,18 +16,25 @@
 */
 #include "hycomp.h"
 #include "hyport.h"
+#include "hycunit.h"
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdio.h>
 #define ERROR_STRING "Argh!"
 
+int test_hyerror_set_last_error(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_set_last_error_with_message(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_last_error_message(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_last_error_number(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_startup(struct HyPortLibrary *hyportLibrary);
+int test_hyerror_shutdown(struct HyPortLibrary *hyportLibrary);
+
 int main (int argc, char **argv, char **envp)
 {
   HyPortLibrary hyportLibrary;
   HyPortLibraryVersion portLibraryVersion;
-  I_32 num;
-  const char *err;
+  int ret;
 
   printf("hyerror:\n");
 
@@ -40,49 +47,128 @@
   }
 
   printf("  portlib initialized\n");
-
-  err = hyportLibrary.error_last_error_message(&hyportLibrary);
-  printf("  err = %s\n", err);
-  if (strncmp(err, "", sizeof("")) != 0) {
-    fprintf(stderr,
-            "hyerror_last_error_message was not empty but \"%s\"\n", err);
+  
+  Hytest_init(&hyportLibrary, "Portlib.Hyerror");
+  Hytest_func(&hyportLibrary, test_hyerror_last_error_message, "hyerror_last_error_message");
+  Hytest_func(&hyportLibrary, test_hyerror_last_error_number, "hyerror_last_error_number");
+  Hytest_func(&hyportLibrary, test_hyerror_set_last_error, "hyerror_set_last_error");
+  Hytest_func(&hyportLibrary, test_hyerror_set_last_error_with_message, "hyerror_set_last_error_with_message");
+  Hytest_func(&hyportLibrary, test_hyerror_startup, "hyerror_startup");
+  Hytest_func(&hyportLibrary, test_hyerror_shutdown, "hyerror_shutdown");
+  ret = Hytest_close_and_output(&hyportLibrary);
+  
+  if (0 != hyportLibrary.port_shutdown_library (&hyportLibrary)) {
+    fprintf(stderr, "portlib shutdown failed\n");
     return 1;
   }
+  
+  printf("  portlib shutdown\n");
+  return 0;
+}
 
-  hyportLibrary.error_set_last_error(&hyportLibrary,
+int test_hyerror_set_last_error(struct HyPortLibrary *hyportLibrary)
+{
+  I_32 num;
+  const char *err;
+  hyportLibrary->error_set_last_error(hyportLibrary,
                                      2, HYPORT_ERROR_NOTFOUND);
-  num = hyportLibrary.error_last_error_number(&hyportLibrary);
-  err = hyportLibrary.error_last_error_message(&hyportLibrary);
+  num = hyportLibrary->error_last_error_number(hyportLibrary);
+  err = hyportLibrary->error_last_error_message(hyportLibrary);
   printf("  num = %d, err = %s\n", num, err);
 
   if (num != HYPORT_ERROR_NOTFOUND) {
-    fprintf(stderr, "hyerror_last_error_number was %d not %d\n",
-            num, HYPORT_ERROR_NOTFOUND);
-    return 1;
+    Hytest_setErrMsg(hyportLibrary, "hyerror_last_error_number Output should be [%d] not
[%d] (%s)\n",
+            HYPORT_ERROR_NOTFOUND,num,HY_GET_CALLSITE());
+    return -1;
   }
 
   if (strncmp(err, "", sizeof("")) == 0) {
-    fprintf(stderr, "hyerror_last_error_message was empty\n");
-    return 1;
+    Hytest_setErrMsg(hyportLibrary, "hyerror_last_error_message was empty(%s)\n",HY_GET_CALLSITE());
+    return -1;
   }
+  return 0;
+}
 
-  hyportLibrary.error_set_last_error_with_message(&hyportLibrary,
+int test_hyerror_set_last_error_with_message(struct HyPortLibrary *hyportLibrary)
+{
+  const char *err;
+  hyportLibrary->error_set_last_error_with_message(hyportLibrary,
                                                   HYPORT_ERROR_NOTFOUND,
                                                   ERROR_STRING);
-  err = hyportLibrary.error_last_error_message(&hyportLibrary);
+  err = hyportLibrary->error_last_error_message(hyportLibrary);
   printf("  err = %s\n", err);
 
   if (strncmp(err, ERROR_STRING, sizeof(ERROR_STRING)) != 0) {
-    fprintf(stderr, "hyerror_last_error_message was %s not %s\n", err,
-            ERROR_STRING);
-    return 1;
+    Hytest_setErrMsg(hyportLibrary, "hyerror_last_error_message Output should be [%s] not
[%s] (%s)\n", ERROR_STRING,
+            err,HY_GET_CALLSITE());
+    return -1;
   }
-  
-  if (0 != hyportLibrary.port_shutdown_library (&hyportLibrary)) {
-    fprintf(stderr, "portlib shutdown failed\n");
-    return 1;
+  return 0;
+}
+
+int test_hyerror_last_error_message(struct HyPortLibrary *hyportLibrary)
+{
+  const char *err;
+  err = hyportLibrary->error_last_error_message(hyportLibrary);
+  printf("  err = %s\n", err);
+  if (strncmp(err, "", sizeof("")) != 0) {
+    Hytest_setErrMsg(hyportLibrary,
+            "hyerror_last_error_message Output should be empty not [%s] (%s)\n", err,HY_GET_CALLSITE());
+    return -1;
   }
-  printf("  portlib shutdown\n");
+  return 0;
+}
+
+int test_hyerror_last_error_number(struct HyPortLibrary *hyportLibrary)
+{
+  hyportLibrary->error_last_error_number(hyportLibrary);
+  return 0;
+}
 
+int test_hyerror_startup(struct HyPortLibrary *hyportLibrary)
+{
+  HyPortLibrary hyportLibrary2;
+  HyPortLibraryVersion portLibraryVersion;
+  I_32 rc;
+  HYPORT_SET_VERSION (&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+  if (0 != hyport_init_library (&hyportLibrary2, &portLibraryVersion,
+                                sizeof (HyPortLibrary)))
+  {
+    fprintf(stderr, "portlib init failed\n");
+    return -1;
+  }
+  rc =
+    hyportLibrary2.error_startup (&hyportLibrary2);
+  if (0 != rc)
+  {
+    Hytest_setErrMsg(hyportLibrary, "error startup failed: %s (%s)\n",
+    hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+    return -1;
+  }
+  hyportLibrary2.error_shutdown(&hyportLibrary2);
+  return 0;
+}
+
+int test_hyerror_shutdown(struct HyPortLibrary *hyportLibrary)
+{
+  HyPortLibrary hyportLibrary2;
+  HyPortLibraryVersion portLibraryVersion;
+  I_32 rc;
+  HYPORT_SET_VERSION (&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+  if (0 != hyport_init_library (&hyportLibrary2, &portLibraryVersion,
+                                sizeof (HyPortLibrary)))
+  {
+    fprintf(stderr, "portlib init failed\n");
+    return -1;
+  }
+  rc =
+    hyportLibrary2.error_startup (&hyportLibrary2);
+  if (0 != rc)
+  {
+    Hytest_setErrMsg(hyportLibrary, "time startup failed: %s (%s)\n",
+    hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+    return -1;
+  }
+  hyportLibrary2.error_shutdown(&hyportLibrary2);
   return 0;
 }

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/unix/makefile?view=diff&rev=548949&r1=548948&r2=548949
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/unix/makefile
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/unix/makefile
Tue Jun 19 23:15:32 2007
@@ -1,29 +1,31 @@
-#  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.
-
-#
-# Makefile for 'hyerror'
-#
-
-include $(HY_HDK)/build/make/defines.mk
-
-BUILDFILES = $(SHAREDSUB)hyerror.o
-MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
-ifeq ($(HY_NO_THR),true)
-MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
-endif
-EXENAME = ../hyerror
-
-include $(HY_HDK)/build/make/rules.mk
+#  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.
+
+#
+# Makefile for 'hyerror'
+#
+
+include $(HY_HDK)/build/make/defines.mk
+
+INCLUDES += -I../../hycunit
+BUILDFILES = $(SHAREDSUB)hyerror.o
+BUILDFILES += ../../hycunit/hycunit.o
+MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
+ifeq ($(HY_NO_THR),true)
+MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
+endif
+EXENAME = ../hyerror
+
+include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/windows/makefile?view=diff&rev=548949&r1=548948&r2=548949
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/windows/makefile
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyerror/windows/makefile
Tue Jun 19 23:15:32 2007
@@ -20,9 +20,10 @@
 !include <$(HY_HDK)\build\make\defines.mak>
 
 EXENAME=..\hyerror.exe
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
+HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
 
 BUILDFILES = $(SHAREDSUB)hyerror.obj
+BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
 MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
 
 !IF "$(HY_NO_THR)" == "true"



Mime
View raw message