Add lint and test jobs to CI pipeline (#82)

* Add lint and test jobs to CI pipeline

Addresses issue #81 — current CI only checks compilation, no tests run.

- lint (ubuntu-latest): gofmt -l and go vet ./... using default Go
  tooling only, no third-party linters per maintainer guidance

- test (ubuntu-latest): runs build_test_files.sh via Docker to generate
  all 18 Go version binaries (stripped/non-stripped x lin/win/mac x
  32/64-bit), then go test ./... covering TestAllVersions,
  TestWeirdBins, and TestExtractStrings_CompareWithFLOSS

- build (windows-latest): existing release job unchanged

* Fix CI failures: gofmt, missing test binary, and add Go 1.23/1.24

* Add Go 1.23/1.24 to test matrix

- Add Go 1.23 and 1.24 to versions array in both build_test_files.sh
  and main_test.go — all 10 binary variants pass for both versions
This commit is contained in:
kamran ul haq
2026-02-26 04:13:39 +05:00
committed by GitHub
parent d7f23b7a3e
commit 0ead0ced52
14 changed files with 172 additions and 135 deletions
+27
View File
@@ -3,6 +3,33 @@ name: Build All
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.1
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.0.0
with:
go-version: '>=1.21.0'
- name: Check formatting
run: test -z "$(gofmt -l .)"
- name: Check vet
run: go vet ./...
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.1
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.0.0
with:
go-version: '>=1.21.0'
- name: Build test binaries
run: bash build_test_files.sh
- name: Run tests
run: go test ./...
build:
runs-on: windows-latest
permissions:
+7 -6
View File
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
package bio
@@ -17,12 +18,12 @@ import (
// because some operating systems place a limit on the number of
// distinct mapped regions per process. As of this writing:
//
// Darwin unlimited
// DragonFly 1000000 (vm.max_proc_mmap)
// FreeBSD unlimited
// Linux 65530 (vm.max_map_count) // TODO: query /proc/sys/vm/max_map_count?
// NetBSD unlimited
// OpenBSD unlimited
// Darwin unlimited
// DragonFly 1000000 (vm.max_proc_mmap)
// FreeBSD unlimited
// Linux 65530 (vm.max_map_count) // TODO: query /proc/sys/vm/max_map_count?
// NetBSD unlimited
// OpenBSD unlimited
var mmapLimit int32 = 1<<31 - 1
func init() {
+1
View File
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd
package bio
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
trap "exit" INT
sudo rm -rf $(pwd)/test/build
versions=("1.22" "1.21" "1.20" "1.19" "1.18" "1.17" "1.16" "1.15" "1.14" "1.13" "1.12" "1.11" "1.10" "1.9" "1.8" "1.7" "1.6" "1.5")
versions=("1.24" "1.23" "1.22" "1.21" "1.20" "1.19" "1.18" "1.17" "1.16" "1.15" "1.14" "1.13" "1.12" "1.11" "1.10" "1.9" "1.8" "1.7" "1.6" "1.5")
for v in "${versions[@]}"
do
GO_TAG=$v
+4 -2
View File
@@ -214,8 +214,10 @@ func NewFileBase(filename, absFilename string) *PosBase {
}
// NewLinePragmaBase returns a new *PosBase for a line directive of the form
// //line filename:line:col
// /*line filename:line:col*/
//
// //line filename:line:col
// /*line filename:line:col*/
//
// at position pos.
func NewLinePragmaBase(pos Pos, filename, absFilename string, line, col uint) *PosBase {
return &PosBase{pos, filename, absFilename, FileSymPrefix + absFilename, line, col, -1}
+1
View File
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
// Generate builtinlist.go from cmd/compile/internal/gc/builtin/runtime.go.
+34 -29
View File
@@ -271,15 +271,16 @@ func (p *ImportedPkg) Write(w *Writer) {
// Symbol definition.
//
// Serialized format:
// Sym struct {
// Name string
// ABI uint16
// Type uint8
// Flag uint8
// Flag2 uint8
// Siz uint32
// Align uint32
// }
//
// Sym struct {
// Name string
// ABI uint16
// Type uint8
// Flag uint8
// Flag2 uint8
// Siz uint32
// Align uint32
// }
type Sym [SymSize]byte
const SymSize = stringRefSize + 2 + 1 + 1 + 1 + 4 + 4
@@ -375,13 +376,14 @@ const HashSize = sha1.Size
// Relocation.
//
// Serialized format:
// Reloc struct {
// Off int32
// Siz uint8
// Type uint8
// Add int64
// Sym SymRef
// }
//
// Reloc struct {
// Off int32
// Siz uint8
// Type uint8
// Add int64
// Sym SymRef
// }
type Reloc [RelocSize]byte
const RelocSize = 4 + 1 + 1 + 8 + 8
@@ -419,10 +421,11 @@ func (r *Reloc) fromBytes(b []byte) { copy(r[:], b) }
// Aux symbol info.
//
// Serialized format:
// Aux struct {
// Type uint8
// Sym SymRef
// }
//
// Aux struct {
// Type uint8
// Sym SymRef
// }
type Aux [AuxSize]byte
const AuxSize = 1 + 8
@@ -462,11 +465,12 @@ func (a *Aux) fromBytes(b []byte) { copy(a[:], b) }
// Referenced symbol flags.
//
// Serialized format:
// RefFlags struct {
// Sym symRef
// Flag uint8
// Flag2 uint8
// }
//
// RefFlags struct {
// Sym symRef
// Flag uint8
// Flag2 uint8
// }
type RefFlags [RefFlagsSize]byte
const RefFlagsSize = 8 + 1 + 1
@@ -489,10 +493,11 @@ func (r *RefFlags) Write(w *Writer) { w.Bytes(r[:]) }
// Referenced symbol name.
//
// Serialized format:
// RefName struct {
// Sym symRef
// Name string
// }
//
// RefName struct {
// Sym symRef
// Name string
// }
type RefName [RefNameSize]byte
const RefNameSize = 8 + stringRefSize
-1
View File
@@ -63,7 +63,6 @@ var SkipDir = errors.New("skip this directory")
// to bypass the directory read entirely.
// - If a directory read fails, the function is called a second time
// for that directory to report the error.
//
type WalkDirFunc func(path string, d DirEntry, err error) error
// walkDir recursively descends path, calling walkDirFn.
+1 -1
View File
@@ -11,7 +11,7 @@ import (
_ "net/http/pprof"
)
var versions = []string{"122", "121", "120", "119", "118", "117", "116", "115", "114", "113", "112", "111", "110", "19", "18", "17", "16", "15"}
var versions = []string{"124", "123", "122", "121", "120", "119", "118", "117", "116", "115", "114", "113", "112", "111", "110", "19", "18", "17", "16", "15"}
var fileNames = []string{"testproject_lin", "testproject_lin_32", "testproject_lin_stripped", "testproject_lin_stripped_32", "testproject_mac", "testproject_mac_stripped", "testproject_win_32.exe", "testproject_win_stripped_32.exe", "testproject_win_stripped.exe", "testproject_win.exe"}
func TestAllVersions(t *testing.T) {
+1
View File
@@ -37,6 +37,7 @@ type SymKind uint8
// These are used to index into cmd/link/internal/sym/AbiSymKindToSymKind
//
// TODO(rsc): Give idiomatic Go names.
//
//go:generate stringer -type=SymKind
const (
// An otherwise invalid zero value for the type
+84 -84
View File
@@ -11,26 +11,26 @@ type FieldName uint8
const (
// ModuleData fields
FieldFtab FieldName = iota // 0
FieldMinpc // 1
FieldText // 2
FieldTypes // 3
FieldEtypes // 4
FieldTextsectmap // 5
FieldTypelinks // 6
FieldItablinks // 7
FieldPkgPath // 8 (for Interface)
FieldMethods // 9 (for Interface)
FieldFtab FieldName = iota // 0
FieldMinpc // 1
FieldText // 2
FieldTypes // 3
FieldEtypes // 4
FieldTextsectmap // 5
FieldTypelinks // 6
FieldItablinks // 7
FieldPkgPath // 8 (for Interface)
FieldMethods // 9 (for Interface)
// Rtype fields (Go reflection types)
FieldSize // 10
FieldPtrdata // 11
FieldHash // 12
FieldUnused // 13
FieldAlign // 14
FieldFieldAlign // 15
FieldKind // 16
FieldStr // 17
FieldTflag // 18
FieldSize // 10
FieldPtrdata // 11
FieldHash // 12
FieldUnused // 13
FieldAlign // 14
FieldFieldAlign // 15
FieldKind // 16
FieldStr // 17
FieldTflag // 18
)
// String representation for debugging/logging
@@ -83,14 +83,14 @@ func (f FieldName) String() string {
type FieldType uint8
const (
FieldTypePvoid FieldType = iota // 0 - pointer/address (void *)
FieldTypeSlice // 1 - Go slice (ptr, len, cap)
FieldTypeString // 2 - Go string (ptr, len)
FieldTypeInt // 3 - integer value
FieldTypeName // 4 - name offset (Go 1.18+)
FieldTypeUint32 // 5 - unsigned 32-bit integer
FieldTypeUint8 // 6 - unsigned 8-bit integer
FieldTypeInt32 // 7 - signed 32-bit integer
FieldTypePvoid FieldType = iota // 0 - pointer/address (void *)
FieldTypeSlice // 1 - Go slice (ptr, len, cap)
FieldTypeString // 2 - Go string (ptr, len)
FieldTypeInt // 3 - integer value
FieldTypeName // 4 - name offset (Go 1.18+)
FieldTypeUint32 // 5 - unsigned 32-bit integer
FieldTypeUint8 // 6 - unsigned 8-bit integer
FieldTypeInt32 // 7 - signed 32-bit integer
)
// String representation for debugging
@@ -167,89 +167,89 @@ var moduleDataLayouts = map[string]*ModuleDataLayout{
"1.21": {
Version: "1.21",
Fields: []FieldInfo{
{Name: FieldFtab, Offset64: 128, Offset32: 64,Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 160, Offset32: 80,Type: FieldTypePvoid},
{Name: FieldText, Offset64: 176, Offset32: 88,Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 296, Offset32: 148,Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 304, Offset32: 152,Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 328, Offset32: 164,Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 352, Offset32: 176,Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 376, Offset32: 188,Type: FieldTypeSlice},
{Name: FieldFtab, Offset64: 128, Offset32: 64, Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 160, Offset32: 80, Type: FieldTypePvoid},
{Name: FieldText, Offset64: 176, Offset32: 88, Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 296, Offset32: 148, Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 304, Offset32: 152, Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 328, Offset32: 164, Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 352, Offset32: 176, Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 376, Offset32: 188, Type: FieldTypeSlice},
},
},
"1.20": {
Version: "1.20",
Fields: []FieldInfo{
{Name: FieldFtab, Offset64: 128, Offset32: 64,Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 160, Offset32: 80,Type: FieldTypePvoid},
{Name: FieldText, Offset64: 176, Offset32: 88,Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 296, Offset32: 148,Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 304, Offset32: 152,Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 328, Offset32: 164,Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 352, Offset32: 176,Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 376, Offset32: 188,Type: FieldTypeSlice},
{Name: FieldFtab, Offset64: 128, Offset32: 64, Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 160, Offset32: 80, Type: FieldTypePvoid},
{Name: FieldText, Offset64: 176, Offset32: 88, Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 296, Offset32: 148, Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 304, Offset32: 152, Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 328, Offset32: 164, Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 352, Offset32: 176, Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 376, Offset32: 188, Type: FieldTypeSlice},
},
},
"1.18": {
Version: "1.18",
Fields: []FieldInfo{
{Name: FieldFtab, Offset64: 128, Offset32: 64,Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 160, Offset32: 80,Type: FieldTypePvoid},
{Name: FieldText, Offset64: 176, Offset32: 88,Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 280, Offset32: 140,Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 288, Offset32: 144,Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 312, Offset32: 156,Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 336, Offset32: 168,Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 360, Offset32: 180,Type: FieldTypeSlice},
{Name: FieldFtab, Offset64: 128, Offset32: 64, Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 160, Offset32: 80, Type: FieldTypePvoid},
{Name: FieldText, Offset64: 176, Offset32: 88, Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 280, Offset32: 140, Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 288, Offset32: 144, Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 312, Offset32: 156, Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 336, Offset32: 168, Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 360, Offset32: 180, Type: FieldTypeSlice},
},
},
"1.16": {
Version: "1.16",
Fields: []FieldInfo{
{Name: FieldFtab, Offset64: 128, Offset32: 64,Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 160, Offset32: 80,Type: FieldTypePvoid},
{Name: FieldText, Offset64: 176, Offset32: 88,Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 280, Offset32: 140,Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 288, Offset32: 144,Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 296, Offset32: 148,Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 320, Offset32: 160,Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 344, Offset32: 172,Type: FieldTypeSlice},
{Name: FieldFtab, Offset64: 128, Offset32: 64, Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 160, Offset32: 80, Type: FieldTypePvoid},
{Name: FieldText, Offset64: 176, Offset32: 88, Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 280, Offset32: 140, Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 288, Offset32: 144, Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 296, Offset32: 148, Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 320, Offset32: 160, Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 344, Offset32: 172, Type: FieldTypeSlice},
},
},
// Legacy Go versions (1.2-1.15)
"1.8": {
Version: "1.8", // Go 1.8-1.15 (ModuleData12_64/32)
Fields: []FieldInfo{
{Name: FieldFtab, Offset64: 24, Offset32: 12,Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 80, Offset32: 40,Type: FieldTypePvoid},
{Name: FieldText, Offset64: 96, Offset32: 48,Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 200, Offset32: 100,Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 208, Offset32: 104,Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 216, Offset32: 108,Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 240, Offset32: 120,Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 264, Offset32: 132,Type: FieldTypeSlice},
{Name: FieldFtab, Offset64: 24, Offset32: 12, Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 80, Offset32: 40, Type: FieldTypePvoid},
{Name: FieldText, Offset64: 96, Offset32: 48, Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 200, Offset32: 100, Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 208, Offset32: 104, Type: FieldTypePvoid},
{Name: FieldTextsectmap, Offset64: 216, Offset32: 108, Type: FieldTypeSlice},
{Name: FieldTypelinks, Offset64: 240, Offset32: 120, Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 264, Offset32: 132, Type: FieldTypeSlice},
},
},
"1.7": {
Version: "1.7", // Go 1.7 (ModuleData12_r17_64/32)
Fields: []FieldInfo{
{Name: FieldFtab, Offset64: 24, Offset32: 12,Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 80, Offset32: 40,Type: FieldTypePvoid},
{Name: FieldText, Offset64: 96, Offset32: 48,Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 200, Offset32: 100,Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 208, Offset32: 104,Type: FieldTypePvoid},
{Name: FieldTypelinks, Offset64: 216, Offset32: 108,Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 240, Offset32: 120,Type: FieldTypeSlice},
{Name: FieldFtab, Offset64: 24, Offset32: 12, Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 80, Offset32: 40, Type: FieldTypePvoid},
{Name: FieldText, Offset64: 96, Offset32: 48, Type: FieldTypePvoid},
{Name: FieldTypes, Offset64: 200, Offset32: 100, Type: FieldTypePvoid},
{Name: FieldEtypes, Offset64: 208, Offset32: 104, Type: FieldTypePvoid},
{Name: FieldTypelinks, Offset64: 216, Offset32: 108, Type: FieldTypeSlice},
{Name: FieldItablinks, Offset64: 240, Offset32: 120, Type: FieldTypeSlice},
},
},
"1.5": {
Version: "1.5", // Go 1.5-1.6 (ModuleData12_r15_r16_64/32)
Fields: []FieldInfo{
{Name: FieldFtab, Offset64: 24, Offset32: 12,Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 80, Offset32: 40,Type: FieldTypePvoid},
{Name: FieldText, Offset64: 96, Offset32: 48,Type: FieldTypePvoid},
{Name: FieldFtab, Offset64: 24, Offset32: 12, Type: FieldTypeSlice},
{Name: FieldMinpc, Offset64: 80, Offset32: 40, Type: FieldTypePvoid},
{Name: FieldText, Offset64: 96, Offset32: 48, Type: FieldTypePvoid},
// Note: No Types/Etypes/Itablinks for 1.5-1.6
{Name: FieldTypelinks, Offset64: 200, Offset32: 100,Type: FieldTypeSlice}, // Legacy format
{Name: FieldTypelinks, Offset64: 200, Offset32: 100, Type: FieldTypeSlice}, // Legacy format
},
},
}
@@ -900,17 +900,17 @@ func getRtypeFieldOffset(layout *RtypeLayout, fieldName FieldName, is64bit bool)
type InterfaceMethodsFormat uint8
const (
IFMethodsPre17 InterfaceMethodsFormat = iota // 1.5-1.6: pointers in imethod
IFMethodsPost17 // 1.7+: nameOff/typeOff in IMethod
IFMethodsPre17 InterfaceMethodsFormat = iota // 1.5-1.6: pointers in imethod
IFMethodsPost17 // 1.7+: nameOff/typeOff in IMethod
)
// InterfaceLayout describes offsets relative to the rtype base for interfaceType
// MethodsOffsetPtrs is the number of pointer-size units after base where the methods slice resides
// PkgPathOffsetPtrs is the number of pointer-size units after base for pkgPath (or -1 if absent)
type InterfaceLayout struct {
MethodsOffsetPtrs int
PkgPathOffsetPtrs int // -1 if not present
MethodsFormat InterfaceMethodsFormat
MethodsOffsetPtrs int
PkgPathOffsetPtrs int // -1 if not present
MethodsFormat InterfaceMethodsFormat
}
// getInterfaceLayout returns the interface layout info for a Go runtime version
@@ -925,7 +925,7 @@ func getInterfaceLayout(version string) *InterfaceLayout {
case "1.7", "1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14",
"1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.22", "1.23", "1.24":
return &InterfaceLayout{
MethodsOffsetPtrs: 1, // pkgPath at +0, methods slice at +1
MethodsOffsetPtrs: 1, // pkgPath at +0, methods slice at +1
PkgPathOffsetPtrs: 0,
MethodsFormat: IFMethodsPost17,
}
+1 -1
View File
@@ -236,7 +236,7 @@ func TestParseModuleDataGeneric_BackwardCompatibility(t *testing.T) {
// TestVersionMapping verifies that version aliases work correctly
func TestVersionMapping(t *testing.T) {
testCases := []struct {
version string
version string
expectedLayoutVer string
}{
{"1.21", "1.21"},
+10 -10
View File
@@ -8,7 +8,7 @@ import (
// TestExtractStrings_ELF tests string extraction from an ELF binary (Linux)
func TestExtractStrings_ELF(t *testing.T) {
testBinary := filepath.Join("..", "testproject", "testproject")
file, err := Open(testBinary)
if err != nil {
t.Skipf("Could not open test binary: %v (run: cd testproject && go build)", err)
@@ -33,7 +33,7 @@ func TestExtractStrings_ELF(t *testing.T) {
// TestExtractStrings_PE tests string extraction from a PE binary (Windows)
func TestExtractStrings_PE(t *testing.T) {
testBinary := filepath.Join("..", "testproject", "testproject.exe")
file, err := Open(testBinary)
if err != nil {
t.Skipf("Could not open Windows test binary: %v (run: cd testproject && GOOS=windows GOARCH=amd64 go build -o testproject.exe)", err)
@@ -101,13 +101,13 @@ func TestIsFullyPrintable(t *testing.T) {
}{
{"hello world", true},
{"runtime.error", true},
{"line1\nline2", true}, // newlines are allowed
{"col1\tcol2", true}, // tabs are allowed
{"windows\r\n", true}, // carriage return allowed
{"\x00\x01\x02\x03", false}, // all non-printable
{"abc\x00\x01", false}, // any non-printable fails (was 80% threshold)
{"mostly ok \x01", false}, // even one non-printable byte fails
{"", false}, // empty string
{"line1\nline2", true}, // newlines are allowed
{"col1\tcol2", true}, // tabs are allowed
{"windows\r\n", true}, // carriage return allowed
{"\x00\x01\x02\x03", false}, // all non-printable
{"abc\x00\x01", false}, // any non-printable fails (was 80% threshold)
{"mostly ok \x01", false}, // even one non-printable byte fails
{"", false}, // empty string
}
for _, tt := range tests {
@@ -121,7 +121,7 @@ func TestIsFullyPrintable(t *testing.T) {
// TestExtractStrings_MinLength validates minimum length filtering
func TestExtractStrings_MinLength(t *testing.T) {
testBinary := filepath.Join("..", "testproject", "testproject")
file, err := Open(testBinary)
if err != nil {
t.Skip("Test binary not available")
BIN
View File
Binary file not shown.