Skip to content

Commit 79989b7

Browse files
grendellojonpryor
authored andcommitted
[Mono.Android-Tests] Fix stat(1) arguments on Linux (#801)
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.
1 parent 6b54d6d commit 79989b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Mono.Android/Test/Mono.Android-Tests.projitems

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
</ItemGroup>
1717
<Target Name="_RecordApkSizes" AfterTargets="DeployUnitTestApks">
1818
<Delete Files="$(MSBuildThisFileDirectory)..\..\..\TestResult-Mono.Android_Tests-values.csv" Condition=" '$(Configuration)' == 'Debug' " />
19-
<Exec Command="stat -f &quot;stat: %z %N&quot; &quot;$(_MonoAndroidTestApkFile)&quot; > $(_MonoAndroidTestApkSizesInput)" />
19+
<Exec Condition=" '$(HostOS)' == 'Darwin' " Command="stat -f &quot;stat: %z %N&quot; &quot;$(_MonoAndroidTestApkFile)&quot; > $(_MonoAndroidTestApkSizesInput)" />
20+
<Exec Condition=" '$(HostOS)' == 'Linux' " Command="stat -c &quot;stat: %s %N&quot; &quot;$(_MonoAndroidTestApkFile)&quot; > $(_MonoAndroidTestApkSizesInput)" />
2021
<Exec Command="unzip -l &quot;$(_MonoAndroidTestApkFile)&quot; >> $(_MonoAndroidTestApkSizesInput)" />
2122
<ProcessPlotInput InputFilename="$(_MonoAndroidTestApkSizesInput)" ApplicationPackageName="$(_MonoAndroidTestPackage)" ResultsFilename="$(MSBuildThisFileDirectory)..\..\..\TestResult-Mono.Android_Tests.xml" DefinitionsFilename="$(MSBuildThisFileDirectory)apk-sizes-definitions-$(Configuration)$(_AotName).txt" AddResults="true" />
2223
</Target>

0 commit comments

Comments
 (0)