@@ -16,6 +16,33 @@ namespace Interop.FunctionalTests
16
16
{
17
17
public static class H2SpecCommands
18
18
{
19
+ #region chmod
20
+ // user permissions
21
+ const int S_IRUSR = 0x100 ;
22
+ const int S_IWUSR = 0x80 ;
23
+ const int S_IXUSR = 0x40 ;
24
+
25
+ // group permission
26
+ const int S_IRGRP = 0x20 ;
27
+ const int S_IWGRP = 0x10 ;
28
+ const int S_IXGRP = 0x8 ;
29
+
30
+ // other permissions
31
+ const int S_IROTH = 0x4 ;
32
+ const int S_IWOTH = 0x2 ;
33
+ const int S_IXOTH = 0x1 ;
34
+
35
+ const int _0755 =
36
+ S_IRUSR | S_IXUSR | S_IWUSR
37
+ | S_IRGRP | S_IXGRP
38
+ | S_IROTH | S_IXOTH ;
39
+
40
+ [ DllImport ( "libc" , SetLastError = true ) ]
41
+ private static extern int chmod ( string pathname , int mode ) ;
42
+
43
+ private static int chmod755 ( string pathname ) => chmod ( pathname , _0755 ) ;
44
+ #endregion
45
+
19
46
private const int TimeoutSeconds = 15 ;
20
47
21
48
private static string GetToolLocation ( )
@@ -27,11 +54,15 @@ private static string GetToolLocation()
27
54
}
28
55
else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
29
56
{
30
- return Path . Combine ( root , "linux" , "h2spec" ) ;
57
+ var toolPath = Path . Combine ( root , "linux" , "h2spec" ) ;
58
+ chmod755 ( toolPath ) ;
59
+ return toolPath ;
31
60
}
32
61
else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
33
62
{
34
- return Path . Combine ( root , "darwin" , "h2spec" ) ;
63
+ var toolPath = Path . Combine ( root , "darwin" , "h2spec" ) ;
64
+ chmod755 ( toolPath ) ;
65
+ return toolPath ;
35
66
}
36
67
throw new NotImplementedException ( "Invalid OS" ) ;
37
68
}
0 commit comments