Skip to content

Commit

Permalink
new: print architectures for each syscall in report.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Oct 13, 2023
1 parent 797529c commit f5650f0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ func main() {
}

// Generate xml report
generateReport(unionMap)
generateReport(unionMap, linuxMap)
}

func generateReport(systemMap SyscallMap) {
func generateReport(systemMap SyscallMap, linuxMap map[string]SyscallMap) {
// Load syscalls mapped to events
supportedMap := loadSyscallMap(*libsRepoRoot+"/driver/syscall_table.c", func(line string) (string, int64) {
line = strings.TrimSpace(line)
Expand All @@ -238,20 +238,28 @@ func generateReport(systemMap SyscallMap) {
defer fW.Close()

table := tablewriter.NewWriter(fW)
table.SetHeader([]string{"Syscall", "Supported"})
table.SetHeader([]string{"Syscall", "Supported", "Architecture"})
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")

sortedSlice := systemMap.SortKeys()

data := make([]string, 3)
for _, kv := range sortedSlice {
data := make([]string, 2)
data[0] = kv.Key
if _, ok := supportedMap[kv.Key]; ok {
data[1] = "🟢"
} else {
data[1] = "🟡"
}

var archs []string
for arch := range linuxMap {
if _, ok := linuxMap[arch][kv.Key]; ok {
archs = append(archs, arch)
}
}
data[2] = strings.Join(archs, ",")
table.Append(data)
}
table.Render() // Send output
Expand Down

0 comments on commit f5650f0

Please sign in to comment.