aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 16:25:59 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:36:00 +0200
commitb3736c2f7cd4d5e2ab14732fd998ae8453bb23fe (patch)
treec8dd64b76252c62ba084ae8c39c91e44b2d36ea9 /tests
parent547966c6f728c6aa4743383c68fc0ac8e8303aba (diff)
Use do_run_from_file() for test_statvfs
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_statvfs.in26
-rw-r--r--tests/core/test_statvfs.out13
-rw-r--r--tests/test_core.py44
3 files changed, 42 insertions, 41 deletions
diff --git a/tests/core/test_statvfs.in b/tests/core/test_statvfs.in
new file mode 100644
index 00000000..f9bd781a
--- /dev/null
+++ b/tests/core/test_statvfs.in
@@ -0,0 +1,26 @@
+
+ #include <stdio.h>
+ #include <errno.h>
+ #include <sys/statvfs.h>
+
+ int main() {
+ struct statvfs s;
+
+ printf("result: %d\n", statvfs("/test", &s));
+ printf("errno: %d\n", errno);
+
+ printf("f_bsize: %lu\n", s.f_bsize);
+ printf("f_frsize: %lu\n", s.f_frsize);
+ printf("f_blocks: %lu\n", s.f_blocks);
+ printf("f_bfree: %lu\n", s.f_bfree);
+ printf("f_bavail: %lu\n", s.f_bavail);
+ printf("f_files: %d\n", s.f_files > 5);
+ printf("f_ffree: %lu\n", s.f_ffree);
+ printf("f_favail: %lu\n", s.f_favail);
+ printf("f_fsid: %lu\n", s.f_fsid);
+ printf("f_flag: %lu\n", s.f_flag);
+ printf("f_namemax: %lu\n", s.f_namemax);
+
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_statvfs.out b/tests/core/test_statvfs.out
new file mode 100644
index 00000000..8c414d09
--- /dev/null
+++ b/tests/core/test_statvfs.out
@@ -0,0 +1,13 @@
+result: 0
+errno: 0
+f_bsize: 4096
+f_frsize: 4096
+f_blocks: 1000000
+f_bfree: 500000
+f_bavail: 500000
+f_files: 1
+f_ffree: 1000000
+f_favail: 1000000
+f_fsid: 42
+f_flag: 2
+f_namemax: 255
diff --git a/tests/test_core.py b/tests/test_core.py
index 3f49e926..ebc7a5eb 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3987,48 +3987,10 @@ def process(filename):
self.do_run_from_file(src, output, post_build=add_pre_run, extra_emscripten_args=['-H', 'libc/fcntl.h,poll.h'])
def test_statvfs(self):
- src = r'''
- #include <stdio.h>
- #include <errno.h>
- #include <sys/statvfs.h>
-
- int main() {
- struct statvfs s;
-
- printf("result: %d\n", statvfs("/test", &s));
- printf("errno: %d\n", errno);
-
- printf("f_bsize: %lu\n", s.f_bsize);
- printf("f_frsize: %lu\n", s.f_frsize);
- printf("f_blocks: %lu\n", s.f_blocks);
- printf("f_bfree: %lu\n", s.f_bfree);
- printf("f_bavail: %lu\n", s.f_bavail);
- printf("f_files: %d\n", s.f_files > 5);
- printf("f_ffree: %lu\n", s.f_ffree);
- printf("f_favail: %lu\n", s.f_favail);
- printf("f_fsid: %lu\n", s.f_fsid);
- printf("f_flag: %lu\n", s.f_flag);
- printf("f_namemax: %lu\n", s.f_namemax);
+ test_path = path_from_root('tests', 'core', 'test_statvfs')
+ src, output = (test_path + s for s in ('.in', '.out'))
- return 0;
- }
- '''
- expected = r'''
- result: 0
- errno: 0
- f_bsize: 4096
- f_frsize: 4096
- f_blocks: 1000000
- f_bfree: 500000
- f_bavail: 500000
- f_files: 1
- f_ffree: 1000000
- f_favail: 1000000
- f_fsid: 42
- f_flag: 2
- f_namemax: 255
- '''
- self.do_run(src, re.sub('(^|\n)\s+', '\\1', expected))
+ self.do_run_from_file(src, output)
def test_libgen(self):
src = r'''