git: testcases: Add regression tests for open() and openat()

Aaron LI aly at crater.dragonflybsd.org
Tue Nov 17 01:30:56 PST 2026


commit d1f14a38bf2b58c3a359f0994cd9bba535603ecb
Author: Aaron LI <aly at aaronly.me>
Date:   Sun Nov 8 14:22:33 2026 +0800

    testcases: Add regression tests for open() and openat()
    
    With the previous open(2) fixes, all the tests pass:
    
    vfs/dotdot testcase:
    ```
    --- open() of dot/dotdot ---
    ok:   open(.) O_WRONLY|O_CREAT                 Is a directory (21)
    ok:   open(.) O_RDWR|O_CREAT                   Is a directory (21)
    ok:   open(.) O_RDONLY|O_CREAT                 Is a directory (21)
    ok:   open(.) O_WRONLY                         Is a directory (21)
    ok:   open(.) O_RDONLY                         OK
    ok:   open(.) O_WRONLY|O_TRUNC|O_CREAT         Is a directory (21)
    ok:   open(.) O_WRONLY|O_CREAT|O_EXCL          File exists (17)
    ok:   open(.) O_RDONLY|O_CREAT|O_EXCL          File exists (17)
    ok:   open(.) O_RDONLY|O_CREAT|O_DIRECTORY     Is a directory (21)
    ok:   open(..) O_WRONLY|O_CREAT                Is a directory (21)
    ok:   open(..) O_RDONLY|O_CREAT                Is a directory (21)
    ok:   open(..) O_WRONLY|O_CREAT|O_EXCL         File exists (17)
    ok:   open(..) O_RDONLY                        OK
    --- open() of an ordinary directory (consistency) ---
    ok:   open(sub) O_WRONLY|O_CREAT               Is a directory (21)
    ok:   open(sub) O_RDONLY|O_CREAT               Is a directory (21)
    ok:   open(sub) O_WRONLY|O_CREAT|O_EXCL        File exists (17)
    ok:   open(sub) O_RDONLY                       OK
    --- mkdir() of dot/dotdot ---
    ok:   mkdir(.)                                 File exists (17)
    ok:   mkdir(./)                                File exists (17)
    ok:   mkdir(..)                                File exists (17)
    ok:   mkdir(sub/.)                             File exists (17)
    ok:   mkdir(sub/..)                            File exists (17)
    ok:   mkdir(newdir)                            OK
    ok:   mkdir(reg)                               File exists (17)
    --- mkfifo()/mknod()/symlink()/link() of dot ---
    ok:   mkfifo(.)                                File exists (17)
    ok:   mknod(.)                                 File exists (17)
    ok:   symlink(x,.)                             File exists (17)
    ok:   link(reg,.)                              File exists (17)
    --- ordinary create still works ---
    ok:   open(new) O_CREAT|O_EXCL (1st)           OK
    ok:   open(new) O_CREAT|O_EXCL (2nd)           File exists (17)
    ok:   open(new) O_CREAT|O_RDONLY               OK
    ok:   mkdir(plain)                             OK
    --- root ---
    ok:   open(/) O_WRONLY|O_CREAT                 Is a directory (21)
    ok:   open(/) O_RDONLY|O_CREAT                 Is a directory (21)
    ok:   open(/) O_WRONLY|O_CREAT|O_EXCL          File exists (17)
    ok:   open(/) O_RDONLY                         OK
    ok:   mkdir(/)                                 File exists (17)
    
    PASSED: 0 failure(s)
    ```
    
    vfs/openat testcase:
    ```
    --- AT_FDCWD ---
    ok:   mkdirat(AT_FDCWD, .)                                 File exists (17)
    ok:   mkdirat(AT_FDCWD, ./)                                File exists (17)
    ok:   mkdirat(AT_FDCWD, ..)                                File exists (17)
    ok:   openat(AT_FDCWD, .) O_WRONLY|O_CREAT                 Is a directory (21)
    ok:   openat(AT_FDCWD, .) O_RDONLY|O_CREAT                 Is a directory (21)
    ok:   openat(AT_FDCWD, .) O_CREAT|O_EXCL                   File exists (17)
    --- dirfd == sub ---
    ok:   mkdirat(sub, .)                                      File exists (17)
    ok:   mkdirat(sub, ..)                                     File exists (17)
    ok:   openat(sub, .) O_WRONLY|O_CREAT                      Is a directory (21)
    ok:   openat(sub, .) O_CREAT|O_EXCL                        File exists (17)
    ok:   openat(sub, ..) O_WRONLY|O_CREAT                     Is a directory (21)
    
    PASSED: 0 failure(s)
    ```
    
    Assisted-by: DeepSeek-v4.1-flash (with Pi Coding Agent)

Summary of changes:
 test/testcases/Makefile                            |   1 +
 test/testcases/runlist.run                         |   2 +
 test/testcases/{libnvmm => vfs}/Makefile           |   4 +-
 test/testcases/vfs/Makefile.inc                    |   2 +
 test/testcases/vfs/dfregress.run                   |   3 +
 .../ioprio => test/testcases/vfs/dotdot}/Makefile  |   2 +-
 test/testcases/vfs/dotdot/dotdot.c                 | 232 +++++++++++++++++++++
 test/testcases/vfs/dotdot/run.sh                   |  33 +++
 .../ioprio => test/testcases/vfs/openat}/Makefile  |   2 +-
 test/testcases/vfs/openat/openat.c                 | 103 +++++++++
 test/testcases/vfs/openat/run.sh                   |  33 +++
 11 files changed, 412 insertions(+), 5 deletions(-)
 copy test/testcases/{libnvmm => vfs}/Makefile (76%)
 create mode 100644 test/testcases/vfs/Makefile.inc
 create mode 100644 test/testcases/vfs/dfregress.run
 copy {usr.bin/ioprio => test/testcases/vfs/dotdot}/Makefile (64%)
 create mode 100644 test/testcases/vfs/dotdot/dotdot.c
 create mode 100644 test/testcases/vfs/dotdot/run.sh
 copy {usr.bin/ioprio => test/testcases/vfs/openat}/Makefile (64%)
 create mode 100644 test/testcases/vfs/openat/openat.c
 create mode 100644 test/testcases/vfs/openat/run.sh

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/d1f14a38bf2b58c3a359f0994cd9bba535603ecb


-- 
DragonFly BSD source repository


More information about the Commits mailing list