Skip to content

Conversation

@grendello
Copy link
Contributor

macOS uses *BSD command-line tools which often take different parameters
than the Linux ones. This is the case with stat(1) which not only expects
different command line parameters but also has different meaning of various
format placeholders (in this case %z means "file size in bytes" on macOS
but "file time stamp timezone in human readable format").

This fixes stat(1) invocation on Linux.

<Target Name="_RecordApkSizes" AfterTargets="DeployUnitTestApks">
<Delete Files="$(MSBuildThisFileDirectory)..\..\..\TestResult-Mono.Android_Tests-values.csv" Condition=" '$(Configuration)' == 'Debug' " />
<Exec Command="stat -f &quot;stat: %z %N&quot; &quot;$(_MonoAndroidTestApkFile)&quot; > $(_MonoAndroidTestApkSizesInput)" />
<Exec Command="unzip -l &quot;$(_MonoAndroidTestApkFile)&quot; >> $(_MonoAndroidTestApkSizesInput)" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this PR entirely *removethisunzip -l` invocation? Is that desired? (It doesn't seem like it's desired.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, curious... I have this line locally

<Delete Files="$(MSBuildThisFileDirectory)..\..\..\TestResult-Mono.Android_Tests-values.csv" Condition=" '$(Configuration)' == 'Debug' " />
<Exec Command="stat -f &quot;stat: %z %N&quot; &quot;$(_MonoAndroidTestApkFile)&quot; > $(_MonoAndroidTestApkSizesInput)" />
<Exec Command="unzip -l &quot;$(_MonoAndroidTestApkFile)&quot; >> $(_MonoAndroidTestApkSizesInput)" />
<Exec Condition=" '$(HostOS)' != 'Linux' " Command="stat -f &quot;stat: %z %N&quot; &quot;$(_MonoAndroidTestApkFile)&quot; > $(_MonoAndroidTestApkSizesInput)" />
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be == 'Darwin'. A (soon-ish!) goal is to be able to run unit tests on Windows, and stat isn't going to work there...

macOS uses *BSD command-line tools which often take different parameters
than the Linux ones. This is the case with stat(1) which not only expects
different command line parameters but also has different meaning of various
format placeholders (in this case %z means "file size in bytes" on macOS
but "file time stamp timezone in human readable format").

This fixes stat(1) invocation on Linux.
@grendello grendello force-pushed the linux-apk-tests-fix branch from 371b149 to 40fd1de Compare August 31, 2017 12:33
@jonpryor jonpryor merged commit 79989b7 into dotnet:master Aug 31, 2017
@grendello grendello deleted the linux-apk-tests-fix branch August 31, 2017 17:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2024
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.

4 participants