Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new: print architectures for each syscall in report. #18

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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