diff options
author | max99x <max99x@gmail.com> | 2011-07-16 15:01:43 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-07-16 15:01:43 +0300 |
commit | 512e39f7a23b69220eeabcb828493fec13a450ec (patch) | |
tree | 55dd1d273946d4ccb4a88615d4c2119d65f4b3e9 /tests/runner.py | |
parent | 00b6ecfcee84834aa81656e1312b2838ccbdcd3f (diff) |
Implemented utime.h.
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 879c7022..1891c4bb 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -2211,6 +2211,50 @@ if 'benchmark' not in sys.argv: ''' self.do_test(src, re.sub('(^|\n)\s+', '\\1', expected)) + def test_utime(self): + def addPreRunAndChecks(filename): + src = open(filename, 'r').read().replace( + '// {{PRE_RUN_ADDITIONS}}', + ''' + var TEST_F1 = FS.createFolder('/', 'writeable', true, true); + var TEST_F2 = FS.createFolder('/', 'unwriteable', true, false); + ''' + ).replace( + '// {{POST_RUN_ADDITIONS}}', + ''' + print('first changed: ' + (TEST_F1.timestamp.getTime() == 1200000000000)); + print('second changed: ' + (TEST_F2.timestamp.getTime() == 1200000000000)); + ''' + ) + open(filename, 'w').write(src) + + src = r''' + #include <stdio.h> + #include <errno.h> + #include <utime.h> + + int main() { + struct utimbuf t = {1000000000, 1200000000}; + char* writeable = "/writeable"; + char* unwriteable = "/unwriteable"; + + utime(writeable, &t); + printf("writeable errno: %d\n", errno); + + utime(unwriteable, &t); + printf("unwriteable errno: %d\n", errno); + + return 0; + } + ''' + expected = ''' + writeable errno: 0 + unwriteable errno: 1 + first changed: true + second changed: false + ''' + self.do_test(src, re.sub('(^|\n)\s+', '\\1', expected), post_build=addPreRunAndChecks) + ### 'Big' tests def test_fannkuch(self): |