xref: /sqlite-3.40.0/test/syscall.test (revision 0fd7d860)
1# 2011 March 29
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12
13set testdir [file dirname $argv0]
14source $testdir/tester.tcl
15source $testdir/lock_common.tcl
16source $testdir/malloc_common.tcl
17
18if {[llength [info commands test_syscall]]==0} {
19  finish_test
20  return
21}
22set testprefix syscall
23
24
25#-------------------------------------------------------------------------
26# Tests for the xSetSystemCall method.
27#
28do_test 1.1.1 {
29  list [catch { test_syscall reset open } msg] $msg
30} {0 {}}
31do_test 1.1.2 {
32  list [catch { test_syscall reset nosuchcall } msg] $msg
33} {1 SQLITE_NOTFOUND}
34do_test 1.1.3 {
35  list [catch { test_syscall reset open } msg] $msg
36} {0 {}}
37do_test 1.1.4 {
38  list [catch { test_syscall reset ""} msg] $msg
39} {1 SQLITE_NOTFOUND}
40
41do_test 1.2 { test_syscall reset } {}
42
43do_test 1.3.1 { test_syscall install {open getcwd access} } {}
44do_test 1.3.2 { test_syscall reset } {}
45
46#-------------------------------------------------------------------------
47# Tests for the xGetSystemCall method.
48#
49do_test 2.1.1 { test_syscall exists open } 1
50do_test 2.1.2 { test_syscall exists nosuchcall } 0
51
52#-------------------------------------------------------------------------
53# Tests for the xNextSystemCall method.
54#
55set syscall_list [list                                \
56    open close access getcwd stat fstat ftruncate     \
57    fcntl read pread write pwrite fchmod              \
58]
59if {[test_syscall exists fallocate]} {lappend syscall_list fallocate}
60do_test 3.1 { test_syscall list } $syscall_list
61
62finish_test
63