Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@Anipik
Copy link

@Anipik Anipik commented Jul 11, 2018

Fixes https://github.com/dotnet/corefx/issues/12403
without fix

Input: 187 ms, 636669266341879837 ticks
  Output: 0 ms, 504911232000000000 ticks
  Directory Created
  Input: 187 ms, 636669266341879837 ticks
  Output: 0 ms, 636669266340000000 ticks

with fix

  Input: 764 ms, 636669013077642750 ticks
  Output: 0 ms, 504910936800000000 ticks
  Directory Created
  Input: 764 ms, 636669013077642750 ticks
  Output: 764 ms, 636669013077642750 ticks
  Finished:    System.IO.FileSystem.Tests

The CI should fail on 4f23720 as fix is not there and pass on the recent commit

@Anipik Anipik requested a review from danmoseley July 11, 2018 17:32
DateTimeKind.Utc);
}

private void CopytoOperation()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: to => To

DateTimeKind.Utc);
yield return TimeFunction.Create(
((testFile, time) => CopytoOperation()),
((testFile) => testFile.LastWriteTimeUtc),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this fits in with this TimeFunction.Create. The purpose of that helper as I understand it is to modify testFile in the first delegate and then validate with the second that it was appropriately changed. But in this new case, testFile isn't being modified in the original delegate, and thus the second delegate is irrelevant. Why is this new test then plugging into this in this way?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to use the same behavior if we wanted to add some other similar tests in the future(Checking that the file still has millisecond attribute after some operation).

But i was not able to properly utilize existing this. For time being, i will just move this to its own test.

FileInfo output = new FileInfo(Path.Combine(TestDirectory, GetTestFileName(), fileName));
input.Create().Dispose();

Assert.NotEqual(0, input.LastWriteTime.Millisecond);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this fail 1/1000 times?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah you are right. I can just retry and sleep similar to what we do in BaseGetSetTimes

output = input.CopyTo(output.FullName, true);

Assert.NotEqual(0, input.LastWriteTime.Millisecond);
Assert.NotEqual(0, output.LastWriteTime.Millisecond);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Anipik
Copy link
Author

Anipik commented Jul 12, 2018

@danmosemsft can you please review this one ?

struct timeval origTimes[2];
origTimes[0].tv_sec = sourceStat.st_atime;
origTimes[0].tv_usec = 0;
origTimes[0].tv_usec = ST_ATIME_NSEC(&sourceStat)/1000;
Copy link
Member

@danmoseley danmoseley Jul 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, I believe we have single space around arithmetic/logical operators

@Anipik Anipik merged commit 387aa6c into dotnet:master Jul 12, 2018
@Anipik Anipik deleted the withoutfix branch July 12, 2018 17:19
@Anipik Anipik restored the withoutfix branch July 13, 2018 04:33
@karelz karelz added this to the 3.0 milestone Jul 19, 2018
alexischr pushed a commit to mono/corefx that referenced this pull request Jan 25, 2019
* test added

* Test Modified

* Adding Implementation

* tabs removed

* modifyingTest

* Fixing build on HFS

* Space around arithemetic operator
alexischr pushed a commit to mono/corefx that referenced this pull request Jan 25, 2019
* test added

* Test Modified

* Adding Implementation

* tabs removed

* modifyingTest

* Fixing build on HFS

* Space around arithemetic operator
marek-safar pushed a commit to mono/corefx that referenced this pull request Feb 1, 2019
* test added

* Test Modified

* Adding Implementation

* tabs removed

* modifyingTest

* Fixing build on HFS

* Space around arithemetic operator
@Anipik Anipik deleted the withoutfix branch February 26, 2019 19:30
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…x#30996)

* test added

* Test Modified

* Adding Implementation

* tabs removed

* modifyingTest

* Fixing build on HFS

* Space around arithemetic operator


Commit migrated from dotnet/corefx@387aa6c
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unix file timestamps only have one-second granularity

4 participants