RFR: 8334339: Test java/nio/file/attribute/BasicFileAttributeView/CreationTime.java fails on alinux3 [v3]
Alan Bateman
alanb at openjdk.org
Fri Jun 21 16:12:15 UTC 2024
On Fri, 21 Jun 2024 15:23:43 GMT, SendaoYan <syan at openjdk.org> wrote:
>> Hi all,
>> The testcase `java/nio/file/attribute/BasicFileAttributeView/CreationTime.java` fails on alinux3(alibaba cloud linux version 3) after [JDK-8316304](https://bugs.openjdk.org/browse/JDK-8316304).
>> The testcase use /tmp directory to create the file and get the createtime(birth time) of this file. But on alinux3(alibaba cloud linux version 3), the /tmp is mount as tmpfs, it's not a real physic disk paitition, it's mount from RAM, and the alinux3 doesn't support get the `birth time` on tmpfs.
>> On ubuntu 22, when I create a file on /dev/shm(it's also a tmpfs type partition), stat also doesn't support `birth time`.
>> According to the [Java API doc](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/attribute/BasicFileAttributes.html#creationTime()), If the file system implementation does not support a time stamp to indicate the time when the file was created, the creationTime() API return the epoch (1970-01-01T00:00:00Z).
>>
>> So in this PR, if the test directory(on linux the test directory is /tmp) doesn't support `birth time`, the test throw a jtreg.SkippedException, rather than report a failure.
>> And in this PR, I create a new test, change the test directory from /tmp to `pwd`, which the current work directory maybe at diffrent partition to /tmp, and the current work directory support `birth time` possibly.
>>
>> The change has been verified on below env:
>>
>> - [x] alinux3 run test CreationTime.java
>> - [x] windows run test CreationTime.java
>>
>> [windows-CreationTime.java.log](https://github.com/user-attachments/files/15857148/windows-CreationTime.java.log)
>> [alinux3-CreationTime.java.log](https://github.com/user-attachments/files/15857149/alinux3-CreationTime.java.log)
>
> SendaoYan has updated the pull request incrementally with two additional commits since the last revision:
>
> - delete unneeded import
> - If the file system doesn't support birth time, then skip this test
test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java line 34:
> 32:
> 33: /* @test id=cwd
> 34: * @bug 8011536 8151430 8316304 8334339
You can drop the list of bugs in the second test description, it only need to be in the first one.
test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java line 37:
> 35: * @summary Basic test for creationTime attribute on platforms/file systems
> 36: * that support it, test directory is JTwork/scratch. The JTwork/scratch
> 37: * directory maybe at diff disk partition to /tmp on linux
I think you should want to say that it tests using the test scratch directory.
test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java line 84:
> 82: System.out.println("creationTime.toMillis() == " + creationTime.toMillis());
> 83: // If the file system doesn't support birth time, then skip this test
> 84: if (0 == creationTime.toMillis()) {
Can you change this to check == 0 rather than the Yoda style.
test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java line 148:
> 146: // create temporary directory to run tests
> 147: Path dir;
> 148: if(0 == args.length) {
Can you change this to `if (args.length == 0)` ?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19737#discussion_r1649164827
PR Review Comment: https://git.openjdk.org/jdk/pull/19737#discussion_r1649165535
PR Review Comment: https://git.openjdk.org/jdk/pull/19737#discussion_r1649164310
PR Review Comment: https://git.openjdk.org/jdk/pull/19737#discussion_r1649163524
More information about the nio-dev
mailing list