Skip to content

Commit

Permalink
Add SunOS to list of supported OS Names (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mesbah-Alam authored Mar 19, 2021
1 parent 696d761 commit de9826f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
5 changes: 5 additions & 0 deletions stf.build/include/top.xml
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,11 @@ limitations under the License.
<contains string="@{osname}" substring="Solaris"/>
</and>
</condition>
<condition property="@{property}" value="sol">
<and>
<contains string="@{osname}" substring="SunOS"/>
</and>
</condition>
<condition property="@{property}" value="bsd">
<and>
<contains string="@{osname}" substring="BSD"/>
Expand Down
3 changes: 3 additions & 0 deletions stf.core/scripts/stf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,9 @@ sub check_free_space {
if ( $df_header =~ m/.*Filesystem\s+1K-blocks.*/ ) {
( $kb_free ) = $df_body =~ /[^\s]*\s+\d+\s+\d+\s+(\d+).*/;
}
elsif ( $df_header =~ m/.*Filesystem\s+kbytes.*/ ) {
( $kb_free ) = $df_body =~ /[^\s]*\s+\d+\s+\d+\s+(\d+).*/;
}
elsif ( $df_header =~ m/.*Filesystem\s+1024-blocks.*/ ) {
( $kb_free ) = $df_body =~ /[^\s]*\s+\d+\s+(\d+).*/;
}
Expand Down
4 changes: 3 additions & 1 deletion stf.core/scripts/stf/stfUtility.pm
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ sub getPlatform {
elsif ($^O eq 'darwin') {
return "osx";
}
elsif ($^O =~ 'bsd') {
elsif ($^O =~ 'solaris') {
return "solaris";
} elsif ($^O =~ 'bsd') {
return "bsd";
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public enum Platform {
AIX("aix"),
ZOS("zos"),
BSD("bsd"),
OSX("osx");
OSX("osx"),
SOLARIS("solaris");

private String shortName;
private Platform(String shortName) { this.shortName = shortName; }
Expand Down Expand Up @@ -193,6 +194,11 @@ private static String calcOSShortName()
if (osName.contains("bsd")) {
osShortName = "bsd";
}

// if we are on sunos use solaris as the shortname
if (osName.contains("sunos")) {
osShortName = "solaris";
}

return osShortName;
}
Expand Down Expand Up @@ -281,4 +287,8 @@ public static boolean isZOS() throws StfException {
public static boolean isOSX() throws StfException {
return getPlatform() == Platform.OSX;
}

public static boolean isSolaris() throws StfException {
return getPlatform() == Platform.SOLARIS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ public String getOsgiOperatingSystemName() throws StfException {
case LINUX: return "linux";
case ZOS : return "zos";
case OSX : return "macosx";
case SOLARIS : return "solaris";
default: throw new StfException("Unknown platform for osgi.os: " + PlatformFinder.getPlatformAsString());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public void doChmod(String comment, DirectoryRef targetDir, String modeBits, Boo
*/
public void doChmod(String comment, FileRef targetFile, String modeBits) throws StfException {
generator.startNewCommand(comment, "chmod", "Change file permission", "targetFile:", targetFile.getSpec(), "modeBits:", modeBits);
if (PlatformFinder.isLinux() || PlatformFinder.isAix() || PlatformFinder.isZOS() || PlatformFinder.isOSX()) {
if (PlatformFinder.isLinux() || PlatformFinder.isAix() || PlatformFinder.isZOS() || PlatformFinder.isOSX() || PlatformFinder.isSolaris()) {
String command = "system('" + "chmod";
command = command + " " + modeBits + " \"" + targetFile+ "\"" + "')";
generator.outputLine("$rc = " + command + ";");
Expand Down

0 comments on commit de9826f

Please sign in to comment.