Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2014-02-05 20:44:38 -0500
committerEugene Tarassov2014-02-05 20:44:38 -0500
commit26a6601f3795b69d8fbe39e44972726ddc45f05a (patch)
tree05b524fc0a6c0d660c95193b069d3b67cb4245d2 /plugins/org.eclipse.tcf.debug
parent9a8e1a90ac1ff9a7804402ce98e0068c392e2f73 (diff)
downloadorg.eclipse.tcf-26a6601f3795b69d8fbe39e44972726ddc45f05a.tar.gz
org.eclipse.tcf-26a6601f3795b69d8fbe39e44972726ddc45f05a.tar.xz
org.eclipse.tcf-26a6601f3795b69d8fbe39e44972726ddc45f05a.zip
TCF Tests: added tests for FileSystem setstat and fsetstat commands
Diffstat (limited to 'plugins/org.eclipse.tcf.debug')
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestFileSystem.java77
1 files changed, 75 insertions, 2 deletions
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestFileSystem.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestFileSystem.java
index 418678284..352e3b384 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestFileSystem.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestFileSystem.java
@@ -477,8 +477,13 @@ class TestFileSystem implements ITCFTest, IFileSystem.DoneStat,
files.realpath(tmp_path, this);
}
else if (state == STATE_WRITE) {
- state = STATE_READ;
- files.open(file_name, IFileSystem.TCF_O_READ, null, this);
+ testSetStat(new Runnable() {
+ @Override
+ public void run() {
+ state = STATE_READ;
+ files.open(file_name, IFileSystem.TCF_O_READ, null, TestFileSystem.this);
+ }
+ });
}
else if (state == STATE_READ) {
state = STATE_OUT;
@@ -541,6 +546,74 @@ class TestFileSystem implements ITCFTest, IFileSystem.DoneStat,
}
}
+ private void testSetStat(final Runnable done) {
+ files.stat(file_name, new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) {
+ if (error != null) {
+ exit(error);
+ return;
+ }
+ FileAttrs new_attrs = new FileAttrs(
+ IFileSystem.ATTR_SIZE | IFileSystem.ATTR_ACMODTIME,
+ attrs.size, 0, 0, 0, attrs.atime, attrs.mtime, null);
+ files.setstat(file_name, new_attrs, new IFileSystem.DoneSetStat() {
+ @Override
+ public void doneSetStat(IToken token, FileSystemException error) {
+ if (error != null) {
+ exit(error);
+ return;
+ }
+ testFSetStat(done);
+ }
+ });
+ }
+ });
+ }
+
+ private void testFSetStat(final Runnable done) {
+ files.open(file_name, IFileSystem.TCF_O_WRITE, null, new IFileSystem.DoneOpen() {
+ @Override
+ public void doneOpen(IToken token, FileSystemException error, final IFileHandle handle) {
+ if (error != null) {
+ exit(error);
+ return;
+ }
+ files.fstat(handle, new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) {
+ if (error != null) {
+ exit(error);
+ return;
+ }
+ FileAttrs new_attrs = new FileAttrs(
+ IFileSystem.ATTR_SIZE | IFileSystem.ATTR_ACMODTIME,
+ attrs.size, 0, 0, 0, attrs.atime, attrs.mtime, null);
+ files.fsetstat(handle, new_attrs, new IFileSystem.DoneSetStat() {
+ @Override
+ public void doneSetStat(IToken token, FileSystemException error) {
+ if (error != null) {
+ exit(error);
+ return;
+ }
+ files.close(handle, new IFileSystem.DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ if (error != null) {
+ exit(error);
+ return;
+ }
+ done.run();
+ }
+ });
+ }
+ });
+ }
+ });
+ }
+ });
+ }
+
private void exit(Throwable x) {
if (!test_suite.isActive(this)) return;
test_suite.done(this, x);

Back to the top