[Vm-dev] FileCopyPlugin 32bit-64bit updates with unit test
David T. Lewis
lewis at mail.msen.com
Mon Nov 19 00:18:45 UTC 2007
This is a set of support code patches that make FileCopyPlugin work on
32/64 bit images and 32/64 bit unix VMs, plus a unit test for verification.
FileCopyPluginTest-dtl.cs provides a unit test to verify operation of
the FileCopyPlugin. Interestingly, the FileCopyPlugin has never worked
correctly on Unix because it answered a primitiveFail after a successful
copy operation. That means that the primitive code was doing the copy,
and the fallback code would re-do it afterward.
The support code changes are in the following files:
- For all platforms (unix and Mac OS are impacted):
platforms/Cross/plugins/FileCopyPlugin/FileCopyPlugin.h
- For Unix:
platforms/unix/plugins/FileCopyPlugin/sqUnixFileCopyPlugin.c
platforms/unix/vm/sqUnixCharConv.c
platforms/unix/vm/sqPlatformSpecific.h
- Mac OS platform code will need an update also, but I did not try to do
this (it should be simple, but I cannot test the result).
- Win32 and RiscOS do not appear to be impacted.
Dave
-------------- next part --------------
'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 18 November 2007 at 7:05:19 pm'!
"Change Set: FileCopyPluginTest-dtl
Date: 18 November 2007
Author: David T. Lewis
Unit test to verify operation of FileCopyPlugin.
Support code changes are required.
For all platforms:
platforms/Cross/plugins/FileCopyPlugin/FileCopyPlugin.h
For Unix:
platforms/unix/plugins/FileCopyPlugin/sqUnixFileCopyPlugin.c
platforms/unix/vm/sqUnixCharConv.c
platforms/unix/vm/sqPlatformSpecific.h
Other platforms will require platform support file updates.
"!
TestCase subclass: #FileCopyPluginTestCase
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Tests-VM-Plugins'!
!FileCopyPluginTestCase methodsFor: 'testing' stamp: 'dtl 11/18/2007 19:04'!
testCopy
"(FileCopyPluginTestCase selector: #testCopy) debug"
| f c foo bar |
foo := FileDirectory default pathName, FileDirectory slash, 'foo.txt'.
bar := FileDirectory default pathName, FileDirectory slash, 'bar.txt'.
FileDirectory default deleteFileNamed: bar.
(FileDirectory default fileExists: foo)
ifFalse: [[f := FileStream fileNamed: foo.
f nextPutAll: 'hello world'; lf]
ensure: [f close]].
self primCopyFileNamed: foo to: bar.
self assert: (FileDirectory default fileExists: bar).
[f := FileStream oldFileNamed: bar.
c := f contentsOfEntireFile]
ensure: [f close].
self assert: (c = 'hello world')
! !
!FileCopyPluginTestCase methodsFor: 'apply primitives' stamp: 'dtl 11/11/2007 17:47'!
primCopyFileNamed: srcName to: dstName
<primitive: 'primitiveFileCopyNamedTo' module:'FileCopyPlugin'> "primitiveExternalCall"
self primitiveFailed! !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cross-plugins-FileCopyPlugin-FileCopyPlugin.h.diff
Type: text/x-diff
Size: 422 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20071118/61944e43/Cross-plugins-FileCopyPlugin-FileCopyPlugin.h.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unix-plugins-FileCopyPlugin-sqUnixFileCopyPlugin.c.diff
Type: text/x-diff
Size: 590 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20071118/61944e43/unix-plugins-FileCopyPlugin-sqUnixFileCopyPlugin.c.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unix-vm-sqPlatformSpecific.h.diff
Type: text/x-diff
Size: 183 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20071118/61944e43/unix-vm-sqPlatformSpecific.h.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unix-vm-sqUnixCharConv.c.diff
Type: text/x-diff
Size: 313 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20071118/61944e43/unix-vm-sqUnixCharConv.c.bin
More information about the Vm-dev
mailing list