Skip to content

Commit

Permalink
gsanity-check gets a -e swith to print what it thinks the environment…
Browse files Browse the repository at this point in the history
… looks like.
  • Loading branch information
ianamason committed May 2, 2018
1 parent a64a1b5 commit de98afc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions shared/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,13 @@ func init() {
LLVMLoggingFile = os.Getenv(envfile)

}

func printEnvironment() {
vars := []string{envpath, envcc, envcxx, envar, envlnk, envcfg, envbc, envlvl, envfile}

LogWrite("\nLiving in this environment:\n\n")
for _, v := range vars {
LogWrite("%v = %v\n", v, os.Getenv(v))
}

}
25 changes: 25 additions & 0 deletions shared/sanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ package shared

import (
"bytes"
"flag"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -87,6 +88,10 @@ then LLVM_AR_NAME should be set to llvm-ar-3.5.
`

type sanityArgs struct {
Environment bool
}

// SanityCheck performs the environmental sanity check.
//
// Performs the following checks in order:
Expand All @@ -98,8 +103,14 @@ then LLVM_AR_NAME should be set to llvm-ar-3.5.
//
func SanityCheck() {

sa := parseSanitySwitches()

LogWrite("\nVersion info: gsanity-check version %v\nReleased: %v\n", gllvmVersion, gllvmReleaseDate)

if sa.Environment {
printEnvironment()
}

checkLogging()

checkOS()
Expand All @@ -116,6 +127,20 @@ func SanityCheck() {

}

func parseSanitySwitches() (sa sanityArgs) {
sa = sanityArgs{
Environment: false,
}

environmentPtr := flag.Bool("e", false, "show environment")

flag.Parse()

sa.Environment = *environmentPtr

return
}

func checkOS() {

platform := runtime.GOOS
Expand Down

0 comments on commit de98afc

Please sign in to comment.