You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/06/22 12:44:26 UTC
svn commit: r549772 [3/3] - in
/harmony/enhanced/classlib/branches/java6/modules:
awt/src/main/java/common/org/apache/harmony/awt/gl/font/
awt/src/main/native/fontlib/unix/ awt/src/main/native/fontlib/windows/
awt/src/main/native/oglwrapper/unix/ beans...
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c Fri Jun 22 03:44:22 2007
@@ -35,6 +35,8 @@
#define CDEV_CURRENT_FUNCTION _prototypes_private
static I_32 findError (I_32 errorCode);
+void convert_path_to_unicode(struct HyPortLibrary * portLibrary, const char *path,
+ wchar_t **pathW);
#undef CDEV_CURRENT_FUNCTION
@@ -87,7 +89,10 @@
hyfile_attr (struct HyPortLibrary * portLibrary, const char *path)
{
DWORD result;
- result = GetFileAttributes ((LPCTSTR) path);
+ wchar_t *pathW;
+ convert_path_to_unicode(portLibrary, path, &pathW);
+ result = GetFileAttributesW ((LPCWSTR) pathW);
+ portLibrary->mem_free_memory(portLibrary, pathW);
if (result == 0xFFFFFFFF)
{
result = GetLastError ();
@@ -327,6 +332,73 @@
#undef CDEV_CURRENT_FUNCTION
+#define CDEV_CURRENT_FUNCTION convert_path_to_unicode
+
+void
+convert_path_to_unicode(struct HyPortLibrary * portLibrary, const char *path,
+ wchar_t **pathW)
+{
+ int len = strlen(path);
+ int wlen;
+ char *canonicalpath;
+ int srcArrayCount=0;
+ int destArrayCount=0;
+ int slashCount=0; //record how many slashes it met.
+ int dotsCount=0; //record how many dots following a separator.
+ int *slashStack; //record position of every separator.
+ slashStack = portLibrary->mem_allocate_memory(portLibrary, len*sizeof(int));
+ canonicalpath = portLibrary->mem_allocate_memory(portLibrary, len+5);
+
+ strcpy(canonicalpath,"\\\\?\\");
+
+ for(srcArrayCount=0,destArrayCount=4;srcArrayCount<len;srcArrayCount++){
+ // the input path of this method has been parsed to absolute path already.
+ if(path[srcArrayCount]=='.'){
+ // count the dots following last separator.
+ if(dotsCount>0 || path[srcArrayCount-1]=='\\'){
+ dotsCount++;
+ continue;
+ }
+ }
+ // deal with the dots when we meet next separator.
+ if(path[srcArrayCount]=='\\'){
+ if(dotsCount == 1){
+ dotsCount = 0;
+ continue;
+ }else if (dotsCount > 1){
+ if(slashCount-2<0){
+ slashCount=2;
+ }
+ destArrayCount=slashStack[slashCount-2];
+ dotsCount = 0;
+ slashCount--;
+ }else{
+ while(canonicalpath[destArrayCount-1] == '.'){
+ destArrayCount--;
+ }
+ slashStack[slashCount++]=destArrayCount;
+ }
+ }
+ // for normal character.
+ while(dotsCount >0){
+ canonicalpath[destArrayCount++]='.';
+ dotsCount--;
+ }
+ canonicalpath[destArrayCount++]=path[srcArrayCount];
+ }
+ while(canonicalpath[destArrayCount-1] == '.'){
+ destArrayCount--;
+ }
+ canonicalpath[destArrayCount]='\0';
+ wlen = MultiByteToWideChar(CP_UTF8, 0, canonicalpath, -1, *pathW, 0);
+ *pathW = portLibrary->mem_allocate_memory(portLibrary, wlen*sizeof(wchar_t));
+ MultiByteToWideChar(CP_UTF8, 0, canonicalpath, -1, *pathW, wlen);
+ portLibrary->mem_free_memory(portLibrary, canonicalpath);
+ portLibrary->mem_free_memory(portLibrary, slashStack);
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
#define CDEV_CURRENT_FUNCTION hyfile_mkdir
/**
* Create a directory.
@@ -341,71 +413,22 @@
I_32 VMCALL
hyfile_mkdir (struct HyPortLibrary * portLibrary, const char *path)
{
- int returnVar=0;
- int len = strlen(path);
- //If the length is longer than 248, unicode format should be used to CreateDirectroy.
- //"." and ".." need be processed in the unicode format.
- if(len >= 248){
- char *canonicalpath;
- int srcArrayCount=0;
- int destArrayCount=0;
- int slashCount=0; //record how many slashes it met.
- int dotsCount=0; //record how many dots following a separator.
- int *slashStack; //record position of every separator.
- slashStack = portLibrary->mem_allocate_memory(portLibrary, len);
- canonicalpath = portLibrary->mem_allocate_memory(portLibrary, len+5);
-
- strcpy(canonicalpath,"\\\\?\\");
-
- for(srcArrayCount=0,destArrayCount=4;srcArrayCount<len;srcArrayCount++){
- // the input path of this method has been parsed to absolute path already.
- if(path[srcArrayCount]=='.'){
- // count the dots following last separator.
- if(dotsCount>0 || path[srcArrayCount-1]=='\\'){
- dotsCount++;
- continue;
- }
- }
- // deal with the dots when we meet next separator.
- if(path[srcArrayCount]=='\\'){
- if(dotsCount == 1){
- dotsCount = 0;
- continue;
- }else if (dotsCount > 1){
- if(slashCount-2<0){
- slashCount=2;
- }
- destArrayCount=slashStack[slashCount-2];
- slashCount--;
- }else{
- slashStack[slashCount++]=destArrayCount;
- }
- }
- // for normal character.
- canonicalpath[destArrayCount]=path[srcArrayCount];
- destArrayCount++;
- dotsCount = 0;
- }
-
- canonicalpath[destArrayCount]='\0';
- returnVar = CreateDirectory (canonicalpath, 0);
-
- portLibrary->mem_free_memory(portLibrary, canonicalpath);
- portLibrary->mem_free_memory(portLibrary, slashStack);
- }else{
- returnVar = CreateDirectory (path, 0);
- }
+ int returnVar=0;
+ wchar_t *pathW;
+ convert_path_to_unicode(portLibrary, path, &pathW);
+ returnVar = CreateDirectoryW (pathW, 0);
+ portLibrary->mem_free_memory(portLibrary, pathW);
- if (returnVar)
- {
- return 0;
+ if (returnVar)
+ {
+ return 0;
}
- else
+ else
{
- I_32 error = GetLastError ();
- portLibrary->error_set_last_error (portLibrary, error,
- findError (error));
- return -1;
+ I_32 error = GetLastError ();
+ portLibrary->error_set_last_error (portLibrary, error,
+ findError (error));
+ return -1;
}
}
@@ -760,20 +783,25 @@
I_32 VMCALL
hyfile_unlinkdir (struct HyPortLibrary * portLibrary, const char *path)
{
+ wchar_t *pathW;
+ convert_path_to_unicode(portLibrary, path, &pathW);
+
/* should be able to delete read-only dirs, so we set the file attribute back to normal */
- if (0 == SetFileAttributes (path, FILE_ATTRIBUTE_NORMAL))
+ if (0 == SetFileAttributesW (pathW, FILE_ATTRIBUTE_NORMAL))
{
I_32 error = GetLastError ();
portLibrary->error_set_last_error (portLibrary, error, findError (error)); /* continue */
}
- if (RemoveDirectory (path))
+ if (RemoveDirectoryW (pathW))
{
+ portLibrary->mem_free_memory(portLibrary, pathW);
return 0;
}
else
{
I_32 error = GetLastError ();
+ portLibrary->mem_free_memory(portLibrary, pathW);
portLibrary->error_set_last_error (portLibrary, error,
findError (error));
return -1;
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/shared/hythread.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/shared/hythread.c?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/shared/hythread.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/shared/hythread.c Fri Jun 22 03:44:22 2007
@@ -1444,17 +1444,19 @@
#define CDEV_CURRENT_FUNCTION hythread_detach
/**
- * Detach a thread from the threading library.
+ * Detaches the current thread from the threading library.
*
- * @note Assumes that the thread being detached is already attached.<br>
+ * Detach must only be called by an attached thread. The actual parameter
+ * must be the the current thread's hythread_t, or NULL (in which case this
+ * function retrieves and uses the current thread's hythread_t). This
+ * function cannot be used to detach an arbitrary thread.
+ *
+ * When detached, internal resources associated with the thread are freed
+ * and the hythread_t structure becomes invalid.
*
- * If the thread is an attached thread, then detach should only be called by the thread
- * itself. Internal resources associated with the thread are freed.
- *
- * If the thread is already dead, this call will destroy it.
- *
- * @param[in] thread a hythread_t representing the thread to be detached.
- * If this is NULL, the current thread is detached.
+ * @param[in] thread
+ * the hythread_t of the current thread to be detached, or NULL
+ * meaning the current thread struct is looked-up and detached.
* @return none
*
* @see hythread_attach
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/unix/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/unix/makefile Fri Jun 22 03:44:22 2007
@@ -28,4 +28,5 @@
endif
EXENAME = ../hycpu
+CLEANFILES=../TEST-*.xml
include $(HY_HDK)/build/make/rules.mk
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/makefile Fri Jun 22 03:44:22 2007
@@ -1,36 +1,37 @@
-# 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 module 'hycpu.exe'
-#
-
-!include <$(HY_HDK)\build\make\defines.mak>
-
-EXENAME=..\hycpu.exe
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
-
-BUILDFILES = $(SHAREDSUB)hycpu.obj
-BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
-MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
-
-!IF "$(HY_NO_THR)" == "true"
-MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hythr$(HY_LINKLIB_SUFFIX)
-!ENDIF
-
-EXEFLAGS=$(conlflags) -subsystem:console
-EXEDLLFILES=$(conlibsdll)
-
-!include <$(HY_HDK)\build\make\rules.mak>
+# 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 module 'hycpu.exe'
+#
+
+!include <$(HY_HDK)\build\make\defines.mak>
+
+EXENAME=..\hycpu.exe
+HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
+
+BUILDFILES = $(SHAREDSUB)hycpu.obj
+BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
+MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
+
+!IF "$(HY_NO_THR)" == "true"
+MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hythr$(HY_LINKLIB_SUFFIX)
+!ENDIF
+
+EXEFLAGS=$(conlflags) -subsystem:console
+EXEDLLFILES=$(conlibsdll)
+CLEANFILES=..\TEST-*.xml
+
+!include <$(HY_HDK)\build\make\rules.mak>
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile Fri Jun 22 03:44:22 2007
@@ -1,31 +1,32 @@
-# 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
+# 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
+
+CLEANFILES=../TEST-*.xml
+include $(HY_HDK)/build/make/rules.mk
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile Fri Jun 22 03:44:22 2007
@@ -32,5 +32,6 @@
EXEFLAGS=$(conlflags) -subsystem:console
EXEDLLFILES=$(conlibsdll)
+CLEANFILES=..\TEST-*.xml
!include <$(HY_HDK)\build\make\rules.mak>
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c Fri Jun 22 03:44:22 2007
@@ -14,25 +14,48 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hycomp.h"
#include "hyport.h"
+#include "hycunit.h"
+#define CDEV_CURRENT_FUNCTION _prototypes_private
+encodeUTF8CharN (UDATA unicode, U_8 * result, U_32 bytesRemaining);
+#undef CDEV_CURRENT_FUNCTION
void cleanup(HyPortLibrary hyportLibrary);
+void generateAbsoluteFilePath(struct HyPortLibrary *hyportLibrary,char *dist , char *fileName);
+void forVprintfTest(struct HyPortLibrary *hyportLibrary,IDATA fd,char* format,...);
+
+int test_hyfile_open(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_write(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_write_text(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_printf(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_sync(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_set_length(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_move(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_seek(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_read(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_length(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_attr(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_error_message(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_findfirst(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_findnext(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_findclose(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_mkdir(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_unlinkdir(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_lastmod(struct HyPortLibrary *hyportLibrary);
+int test_hyfile_vprintf(struct HyPortLibrary *hyportLibrary);
int main (int argc, char **argv, char **envp)
{
HyPortLibrary hyportLibrary;
HyPortLibraryVersion portLibraryVersion;
- IDATA fd;
- IDATA bytes;
- IDATA rc;
- I_64 offset;
- char buf[20];
- I_64 length;
+ int ret = 0;
printf("hyfile:\n");
@@ -46,156 +69,906 @@
printf(" portlib initialized\n");
- fd = hyportLibrary.file_open(&hyportLibrary, "hytest.tmp",
+ Hytest_init(&hyportLibrary, "Portlib.Hyfile");
+ Hytest_func(&hyportLibrary, test_hyfile_open, "hyfile_open");
+ Hytest_func(&hyportLibrary, test_hyfile_write, "hyfile_write");
+ Hytest_func(&hyportLibrary, test_hyfile_write_text, "hyfile_write_text");
+ Hytest_func(&hyportLibrary, test_hyfile_printf, "hyfile_printf");
+ Hytest_func(&hyportLibrary, test_hyfile_sync, "hyfile_sync");
+ Hytest_func(&hyportLibrary, test_hyfile_set_length, "hyfile_set_length");
+ Hytest_func(&hyportLibrary, test_hyfile_move, "hyfile_move");
+ Hytest_func(&hyportLibrary, test_hyfile_seek, "hyfile_seek");
+ Hytest_func(&hyportLibrary, test_hyfile_read, "hyfile_read");
+ Hytest_func(&hyportLibrary, test_hyfile_length, "hyfile_length");
+ Hytest_func(&hyportLibrary, test_hyfile_attr, "hyfile_attr");
+ Hytest_func(&hyportLibrary, test_hyfile_error_message, "hyfile_error_message");
+ Hytest_func(&hyportLibrary, test_hyfile_findfirst, "hyfile_findfirst");
+ Hytest_func(&hyportLibrary, test_hyfile_findnext, "hyfile_findnext");
+ Hytest_func(&hyportLibrary, test_hyfile_findclose, "hyfile_findclose");
+ Hytest_func(&hyportLibrary, test_hyfile_mkdir, "hyfile_mkdir");
+ Hytest_func(&hyportLibrary, test_hyfile_unlinkdir, "hyfile_unlinkdir");
+ Hytest_func(&hyportLibrary, test_hyfile_lastmod, "hyfile_lastmod");
+ Hytest_func(&hyportLibrary, test_hyfile_vprintf, "hyfile_vprintf");
+ 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 ret;
+}
+
+void cleanup(HyPortLibrary hyportLibrary)
+{
+ char tmpAbsolutePath[255];
+ generateAbsoluteFilePath(&hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ hyportLibrary.file_unlink(&hyportLibrary, tmpAbsolutePath);
+ generateAbsoluteFilePath(&hyportLibrary,tmpAbsolutePath,"hytest.tmp2");
+ hyportLibrary.file_unlink(&hyportLibrary, tmpAbsolutePath);
+ generateAbsoluteFilePath(&hyportLibrary,tmpAbsolutePath,"hytest.dir.tmp");
+ hyportLibrary.file_unlinkdir(&hyportLibrary, tmpAbsolutePath);
+}
+
+void generateAbsoluteFilePath(struct HyPortLibrary *hyportLibrary,char *dist , char *fileName)
+{
+ char* buf;
+ int i=0;
+ hyportLibrary->sysinfo_get_executable_name(hyportLibrary,"",&buf);
+ i=strlen(buf)-1;
+ for(;i>=0;i--)
+ {
+ if(buf[i]==DIR_SEPARATOR)
+ {
+ buf[i+1]='\0';
+ break;
+ }
+ }
+ strcpy(dist,buf);
+ strcpy(&dist[i+1],fileName);
+ hyportLibrary->mem_free_memory(hyportLibrary, buf);
+}
+
+int test_hyfile_open(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_open......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
HyOpenCreate | HyOpenWrite | HyOpenTruncate,
0600);
printf(" fd = %d\n", fd);
- if (!fd) {
- fprintf(stderr, "Failed to open hytest.tmp for write %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+ return 0;
+}
- bytes = hyportLibrary.file_write(&hyportLibrary, fd, (void*)"testing", 7);
+int test_hyfile_write(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ IDATA bytes;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_write......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s\n(%s)",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ bytes = hyportLibrary->file_write(hyportLibrary, fd, (void*)"testing", 7);
printf(" hyfile_write wrote %d bytes\n", bytes);
if (bytes != 7) {
- fprintf(stderr, "hyfile_write wrote %d bytes not %d\n", bytes, 7);
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "Output should be [%d] not [%d] (%s)\n", 7, bytes,HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- rc = hyportLibrary.file_write_text(&hyportLibrary, fd, "testing", 7);
+int test_hyfile_write_text(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_write_text......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_write_text(hyportLibrary, fd, "testing", 7);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_write_text write failed: %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
if (rc != 0) {
- fprintf(stderr, "hyfile_write_text write failed: %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+ return 0;
+}
- hyportLibrary.file_printf(&hyportLibrary, fd, "%d%c%s", 1, '2', "3");
- rc = hyportLibrary.file_sync(&hyportLibrary, fd);
+int test_hyfile_printf(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ IDATA bytes;
+ char tmpAbsolutePath[255];
+ char buf[255];
+
+ printf("testing hyfile_printf......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ hyportLibrary->file_printf(hyportLibrary, fd, "%09d %7.4d %7.2f",9,-2,3.1415926535);
+
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenRead, 0000);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open hytest.tmp for read %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ bytes = hyportLibrary->file_read(hyportLibrary, fd, buf, 25);
+ printf(" bytes = %d\n", bytes);
+ buf[bytes] = '\0';
+ printf(" buf = %s\n", buf);
+
+ if (bytes != 25) {
+ Hytest_setErrMsg(hyportLibrary, "Output should be [%d] not [%d](%s)\n",25,bytes,HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+
+ if (strcmp(buf, "000000009 -0002 3.14") != 0) {
+ Hytest_setErrMsg(hyportLibrary, "Output should be [%s] not [%s] (%s)\n","000000009 -0002 3.14",buf,HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
if (rc != 0) {
- fprintf(stderr, "hyfile_sync failed %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+ return 0;
+}
- rc = hyportLibrary.file_close(&hyportLibrary, fd);
+int test_hyfile_sync(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_sync......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ hyportLibrary->file_printf(hyportLibrary, fd, "%d%c%s\n", 1, '2', "3");
+ rc = hyportLibrary->file_sync(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_sync failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
if (rc != 0) {
- fprintf(stderr, "hyfile_close failed %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+ return 0;
+}
- rc = hyportLibrary.file_move(&hyportLibrary, "hytest.tmp", "hytest.tmp2");
+int test_hyfile_set_length(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_set_length......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_set_length (hyportLibrary, fd, 200);
+ if(0 != rc)
+ {
+ Hytest_setErrMsg(hyportLibrary, "Failed to set file hytest.tmp2's length %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
if (rc != 0) {
- fprintf(stderr, "hyfile_move failed %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- fd = hyportLibrary.file_open(&hyportLibrary, "hytest.tmp2",
- HyOpenRead, 0000);
+int test_hyfile_move(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+ char tmp2AbsolutePath[255];
+
+ printf("testing hyfile_move......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
printf(" fd = %d\n", fd);
- if (!fd) {
- fprintf(stderr, "Failed to open hytest.tmp2 for read %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ generateAbsoluteFilePath(hyportLibrary,tmp2AbsolutePath,"hytest2.tmp");
+ rc = hyportLibrary->file_move(hyportLibrary, tmpAbsolutePath, tmp2AbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_move failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmp2AbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+ return 0;
+}
- offset = hyportLibrary.file_seek(&hyportLibrary, fd, -10, HySeekEnd);
+int test_hyfile_seek(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ I_64 offset;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_seek......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_set_length (hyportLibrary, fd, 200);
+ if(0 != rc)
+ {
+ Hytest_setErrMsg(hyportLibrary, "Failed to set file hytest.tmp2's length %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ offset = hyportLibrary->file_seek(hyportLibrary, fd, -193, HySeekEnd);
printf(" offset = %d\n", offset);
if (offset != 7) {
- fprintf(stderr, "Failed to seek hytest.tmp2\n");
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "Output should be [%d] not [%d] (%s)\n",7,offset,HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- bytes = hyportLibrary.file_read(&hyportLibrary, fd, buf, 10);
+int test_hyfile_read(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ IDATA bytes;
+ char tmpAbsolutePath[255];
+ char buf[20];
+
+ printf("testing hyfile_read......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_write_text(hyportLibrary, fd, "0123456789", 10);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_write_text write failed: %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenRead, 0000);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open hytest.tmp for read %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ bytes = hyportLibrary->file_read(hyportLibrary, fd, buf, 5);
printf(" bytes = %d\n", bytes);
buf[bytes] = '\0';
printf(" buf = %s\n", buf);
- if (bytes != 10) {
- fprintf(stderr, "Failed to read hytest.tmp2\n");
- cleanup(hyportLibrary);
- exit(1);
+
+ if (bytes != 5) {
+ Hytest_setErrMsg(hyportLibrary, "Output should be [%d] not [%d] (%s)\n",5,bytes,HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ if (strcmp(buf, "01234") != 0) {
+ Hytest_setErrMsg(hyportLibrary, "Output should be [%s] not [%s] (%s)\n","02134",buf,HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- if (strcmp(buf, "testing123") != 0) {
- fprintf(stderr, "Failed to read correct content from hytest.tmp2\n");
- cleanup(hyportLibrary);
- exit(1);
+int test_hyfile_length(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ I_64 length;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_length......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_set_length (hyportLibrary, fd, 200);
+ if(0 != rc)
+ {
+ Hytest_setErrMsg(hyportLibrary, "Failed to set file hytest.tmp2's length %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ length = hyportLibrary->file_length(hyportLibrary, tmpAbsolutePath);
+ printf(" length = %d\n", length);
+ if (length != 200) {
+ Hytest_setErrMsg(hyportLibrary, "Output should be [%d] not [%d] (%s)\n",200,length,HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- rc = hyportLibrary.file_close(&hyportLibrary, fd);
+int test_hyfile_attr(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+ printf("testing hyfile_attr......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ hyportLibrary->file_close(hyportLibrary, fd);
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ if (hyportLibrary->file_attr(hyportLibrary, tmpAbsolutePath) != HyIsFile) {
+ Hytest_setErrMsg(hyportLibrary, "hytest.tmp has incorrect type(%s)\n",HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
if (rc != 0) {
- fprintf(stderr, "hyfile_close failed %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- length = hyportLibrary.file_length(&hyportLibrary, "hytest.tmp2");
- printf(" length = %d\n", length);
- if (length != 17) {
- fprintf(stderr, "hytest.tmp2 has incorrect length\n");
- cleanup(hyportLibrary);
- exit(1);
+int test_hyfile_error_message(struct HyPortLibrary *hyportLibrary)
+{
+ printf("testing hyfile_error_message......\n");
+ printf(" file_error_message: %s\n",hyportLibrary->file_error_message(hyportLibrary));
+ return 0;
+}
+
+int test_hyfile_findfirst(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ char tmpAbsolutePath[255];
+ char buf[100];
+
+ printf("testing hyfile_findfirst......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"");
+
+
+ fd = hyportLibrary->file_findfirst(hyportLibrary , tmpAbsolutePath, buf);
+ printf(" resultbuf: %s\n",buf);
+ if(fd==-1){
+ Hytest_setErrMsg(hyportLibrary, "Can not find file.(%s)\n",HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- if (hyportLibrary.file_attr(&hyportLibrary, "hytest.tmp2") != HyIsFile) {
- fprintf(stderr, "hytest.tmp2 has incorrect type\n");
- cleanup(hyportLibrary);
- exit(1);
+int test_hyfile_findnext(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+ char buf[100];
+
+ printf("testing hyfile_findnext......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"");
+
+ fd = hyportLibrary->file_findfirst(hyportLibrary , tmpAbsolutePath, buf);
+ printf(" resultbuf: %s\n",buf);
+ if(fd==-1){
+ Hytest_setErrMsg(hyportLibrary, "Can not find file.(%s)\n",HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_findnext(hyportLibrary, fd, buf);
+ if(rc == 0 ) {
+ printf(" find next successfully! resultbuf: %s\n",buf);
+ }
+ else if(rc == -1){
+ printf(" find failed!\n");
}
+
+ return 0;
+}
- rc = hyportLibrary.file_unlink(&hyportLibrary, "hytest.tmp2");
- if (rc != 0) {
- fprintf(stderr, "hyfile_unlink failed %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+int test_hyfile_findclose(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+ char buf[100];
+
+ printf("testing hyfile_findclose......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"");
+
+ fd = hyportLibrary->file_findfirst(hyportLibrary , tmpAbsolutePath, buf);
+ printf(" resultbuf: %s\n",buf);
+ if(fd==-1){
+ Hytest_setErrMsg(hyportLibrary, "Can not find file.(%s)\n",HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_findnext(hyportLibrary, fd, buf);
+ if(rc == 0 ) {
+ printf(" find next successfully! resultbuf: %s\n",buf);
+ }
+ else if(rc == -1){
+ printf(" find failed!\n");
}
+
+ hyportLibrary->file_findclose(hyportLibrary , fd);
+ return 0;
+}
- rc = hyportLibrary.file_mkdir(&hyportLibrary, "hytest.dir.tmp");
+int test_hyfile_mkdir(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA rc;
+ char tmpAbsolutePath[255];
+ char utf8Dir[10];
+ int utf8len=0;
+
+ utf8Dir[0]='d';
+ utf8Dir[1]='i';
+ utf8Dir[2]='r';
+ utf8len = encodeUTF8CharN (0x3400, &utf8Dir[3], 7);
+ utf8Dir[utf8len+3]='\0';
+
+ printf("testing hyfile_mkdir......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,utf8Dir);
+
+ rc = hyportLibrary->file_mkdir(hyportLibrary, tmpAbsolutePath);
if (rc != 0) {
- fprintf(stderr, "hyfile_mkdir failed %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "hyfile_mkdir failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ if (hyportLibrary->file_attr(hyportLibrary, tmpAbsolutePath) != HyIsDir) {
+ Hytest_setErrMsg(hyportLibrary, "hytest.dir.tmp has incorrect type(%s)\n",HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
-
- if (hyportLibrary.file_attr(&hyportLibrary, "hytest.dir.tmp") != HyIsDir) {
- fprintf(stderr, "hytest.dir.tmp has incorrect type\n");
- cleanup(hyportLibrary);
- exit(1);
+
+ rc = hyportLibrary->file_unlinkdir(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlinkdir failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- rc = hyportLibrary.file_unlinkdir(&hyportLibrary, "hytest.dir.tmp");
+int test_hyfile_unlinkdir(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA rc;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_unlinkdir......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.dir.tmp");
+ rc = hyportLibrary->file_mkdir(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_mkdir failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ if (hyportLibrary->file_attr(hyportLibrary, tmpAbsolutePath) != HyIsDir) {
+ Hytest_setErrMsg(hyportLibrary, "hytest.dir.tmp has incorrect type(%s)\n",HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlinkdir(hyportLibrary, tmpAbsolutePath);
if (rc != 0) {
- fprintf(stderr, "hyfile_unlinkdir failed %s\n",
- hyportLibrary.error_last_error_message(&hyportLibrary));
- cleanup(hyportLibrary);
- exit(1);
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlinkdir failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
+ return 0;
+}
- if (0 != hyportLibrary.port_shutdown_library (&hyportLibrary)) {
- fprintf(stderr, "portlib shutdown failed\n");
- return 1;
+int test_hyfile_lastmod(struct HyPortLibrary *hyportLibrary)
+{
+ IDATA fd;
+ IDATA rc;
+ I_64 time;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_lastmod......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
}
- printf(" portlib shutdown\n");
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ time = hyportLibrary->file_lastmod (hyportLibrary, tmpAbsolutePath);
+ printf(" last modify time = %I64d\n", time);
+ if (time == -1) {
+ Hytest_setErrMsg(hyportLibrary, "fail to get last modify time(%s)\n",HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+ return 0;
+}
+int test_hyfile_vprintf(struct HyPortLibrary *hyportLibrary)
+{
+
+ IDATA fd;
+ IDATA rc;
+ char tmpAbsolutePath[255];
+
+ printf("testing hyfile_printf......\n");
+ generateAbsoluteFilePath(hyportLibrary,tmpAbsolutePath,"hytest.tmp");
+ fd = hyportLibrary->file_open(hyportLibrary, tmpAbsolutePath,
+ HyOpenCreate | HyOpenWrite | HyOpenTruncate,
+ 0600);
+ printf(" fd = %d\n", fd);
+ if (fd==-1) {
+ Hytest_setErrMsg(hyportLibrary, "Failed to open file hytest.tmp%s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+
+ forVprintfTest(hyportLibrary,fd,"%09d",9);
+
+ rc = hyportLibrary->file_close(hyportLibrary, fd);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_close failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
+ rc = hyportLibrary->file_unlink(hyportLibrary, tmpAbsolutePath);
+ if (rc != 0) {
+ Hytest_setErrMsg(hyportLibrary, "hyfile_unlink failed %s(%s)\n",
+ hyportLibrary->error_last_error_message(hyportLibrary),HY_GET_CALLSITE());
+ cleanup(*hyportLibrary);
+ return -1;
+ }
return 0;
}
-void cleanup(HyPortLibrary hyportLibrary)
+void forVprintfTest(struct HyPortLibrary *hyportLibrary,IDATA fd,char* format,...)
{
- hyportLibrary.file_unlink(&hyportLibrary, "hytest.tmp");
- hyportLibrary.file_unlink(&hyportLibrary, "hytest.tmp2");
- hyportLibrary.file_unlinkdir(&hyportLibrary, "hytest.dir.tmp");
+ va_list args;
+ va_start (args, format);
+ hyportLibrary->file_vprintf (hyportLibrary, fd, format, args);
+ va_end (args);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/unix/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/unix/makefile Fri Jun 22 03:44:22 2007
@@ -19,11 +19,14 @@
include $(HY_HDK)/build/make/defines.mk
+INCLUDES += -I../../hycunit
BUILDFILES = $(SHAREDSUB)hyfile.o
+BUILDFILES += ../../hycunit/hycunit.o
MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
ifeq ($(HY_NO_THR),true)
MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
endif
EXENAME = ../hyfile
+CLEANFILES=../TEST-*.xml
include $(HY_HDK)/build/make/rules.mk
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/windows/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/windows/makefile Fri Jun 22 03:44:22 2007
@@ -20,9 +20,10 @@
!include <$(HY_HDK)\build\make\defines.mak>
EXENAME=..\hyfile.exe
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
+HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
BUILDFILES = $(SHAREDSUB)hyfile.obj
+BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
!IF "$(HY_NO_THR)" == "true"
@@ -31,5 +32,6 @@
EXEFLAGS=$(conlflags) -subsystem:console
EXEDLLFILES=$(conlibsdll)
+CLEANFILES=..\TEST-*.xml
!include <$(HY_HDK)\build\make\rules.mak>
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/unix/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/unix/makefile Fri Jun 22 03:44:22 2007
@@ -28,4 +28,5 @@
endif
EXENAME = ../hygp
+CLEANFILES=../TEST-*.xml
include $(HY_HDK)/build/make/rules.mk
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/makefile Fri Jun 22 03:44:22 2007
@@ -1,36 +1,37 @@
-# 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 module 'hygp.exe'
-#
-
-!include <$(HY_HDK)\build\make\defines.mak>
-
-EXENAME=..\hygp.exe
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
-
-BUILDFILES = $(SHAREDSUB)hygp.obj
-BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
-MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
-
-!IF "$(HY_NO_THR)" == "true"
-MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hythr$(HY_LINKLIB_SUFFIX)
-!ENDIF
-
-EXEFLAGS=$(conlflags) -subsystem:console
-EXEDLLFILES=$(conlibsdll)
-
-!include <$(HY_HDK)\build\make\rules.mak>
+# 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 module 'hygp.exe'
+#
+
+!include <$(HY_HDK)\build\make\defines.mak>
+
+EXENAME=..\hygp.exe
+HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
+
+BUILDFILES = $(SHAREDSUB)hygp.obj
+BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
+MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
+
+!IF "$(HY_NO_THR)" == "true"
+MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hythr$(HY_LINKLIB_SUFFIX)
+!ENDIF
+
+EXEFLAGS=$(conlflags) -subsystem:console
+EXEDLLFILES=$(conlibsdll)
+CLEANFILES=..\TEST-*.xml
+
+!include <$(HY_HDK)\build\make\rules.mak>
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/unix/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/unix/makefile Fri Jun 22 03:44:22 2007
@@ -28,4 +28,5 @@
endif
EXENAME = ../hymem
+CLEANFILES=../TEST-*.xml
include $(HY_HDK)/build/make/rules.mk
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/makefile Fri Jun 22 03:44:22 2007
@@ -1,36 +1,37 @@
-# 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 module 'hymem.exe'
-#
-
-!include <$(HY_HDK)\build\make\defines.mak>
-
-EXENAME=..\hymem.exe
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
-
-BUILDFILES = $(SHAREDSUB)hymem.obj
-BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
-MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
-
-!IF "$(HY_NO_THR)" == "true"
-MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hythr$(HY_LINKLIB_SUFFIX)
-!ENDIF
-
-EXEFLAGS=$(conlflags) -subsystem:console
-EXEDLLFILES=$(conlibsdll)
-
-!include <$(HY_HDK)\build\make\rules.mak>
+# 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 module 'hymem.exe'
+#
+
+!include <$(HY_HDK)\build\make\defines.mak>
+
+EXENAME=..\hymem.exe
+HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I..\..\hycunit
+
+BUILDFILES = $(SHAREDSUB)hymem.obj
+BUILDFILES = $(BUILDFILES) ..\..\hycunit\hycunit.obj
+MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hyprt$(HY_LINKLIB_SUFFIX)
+
+!IF "$(HY_NO_THR)" == "true"
+MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hythr$(HY_LINKLIB_SUFFIX)
+!ENDIF
+
+EXEFLAGS=$(conlflags) -subsystem:console
+EXEDLLFILES=$(conlibsdll)
+CLEANFILES=..\TEST-*.xml
+
+!include <$(HY_HDK)\build\make\rules.mak>
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile Fri Jun 22 03:44:22 2007
@@ -1,31 +1,32 @@
-# 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 'hytime'
-#
-
-include $(HY_HDK)/build/make/defines.mk
-
-INCLUDES += -I../../hycunit
-BUILDFILES = $(SHAREDSUB)hytime.o
-BUILDFILES += ../../hycunit/hycunit.o
-MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
-ifeq ($(HY_NO_THR),true)
-MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
-endif
-EXENAME = ../hytime
-
-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 'hytime'
+#
+
+include $(HY_HDK)/build/make/defines.mk
+
+INCLUDES += -I../../hycunit
+BUILDFILES = $(SHAREDSUB)hytime.o
+BUILDFILES += ../../hycunit/hycunit.o
+MDLLIBFILES += $(DLLPATH)libhyprt$(HY_LINKLIB_SUFFIX)
+ifeq ($(HY_NO_THR),true)
+MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
+endif
+EXENAME = ../hytime
+
+CLEANFILES=../TEST-*.xml
+include $(HY_HDK)/build/make/rules.mk
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile Fri Jun 22 03:44:22 2007
@@ -32,5 +32,6 @@
EXEFLAGS=$(conlflags) -subsystem:console
EXEDLLFILES=$(conlibsdll)
+CLEANFILES=..\TEST-*.xml
!include <$(HY_HDK)\build\make\rules.mak>
Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/init/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java Fri Jun 22 03:44:22 2007
@@ -1049,19 +1049,6 @@
// Create the builder and parse the file
DocumentBuilder builder = factory.newDocumentBuilder();
- builder.setEntityResolver(new EntityResolver() {
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
- if (systemId.equals("http://java.sun.com/dtd/preferences.dtd")) {
- InputSource result = new InputSource(
- AbstractPreferencesTest.class
- .getResourceAsStream("/prefs/java/util/prefs/preferences.dtd"));
- result.setSystemId("preferences.dtd");
- return result;
- }
- throw new SAXException("Invalid DOCTYPE:" + systemId);
- }
- });
Document doc = builder.parse(input);
return doc;
}