Skip to content

Commit

Permalink
fix: skip checking linkname when running PCSP test
Browse files Browse the repository at this point in the history
  • Loading branch information
HeRaNO committed Aug 20, 2024
1 parent d9c9ca1 commit 3b15887
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/unit_test-linux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
./scripts/test_race.sh
- name: PCSP Test
env:
GOVERSION: ${{ matrix.go-version }}
run: python3 ./scripts/test_pcsp.py


Expand Down
13 changes: 12 additions & 1 deletion scripts/test_pcsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def clear_files():
run_cmd("rm -vrf ./internal/native/sse/traceback_test.go")
run_cmd("rm -vrf ./internal/native/avx2/traceback_test.go")

def check_ge_go_1_23() -> bool:
ver = os.getenv("GOVERSION")
if ver is None:
print("Cannot get go version")
exit(1)
major, minor, _ = ver.split('.')
return int(major) > 1 or int(minor) >= 23

def main():
TRACE_TEST_FILE = "./internal/native/traceback_test.mock_tmpl"
pattern = "*_text_amd64.go"
Expand All @@ -74,9 +82,12 @@ def main():
run_cmd("sed -e 's/{{PACKAGE}}/sse/g' %s > ./internal/native/sse/traceback_test.go" %TRACE_TEST_FILE)
run_cmd("sed -e 's/{{PACKAGE}}/avx2/g' %s > ./internal/native/avx2/traceback_test.go" %TRACE_TEST_FILE)

# check whether we need an extra ldflags
ext_flag = ' -ldflags=-checklinkname=0 ' if check_ge_go_1_23() else ' '

# test the pcsp with Golang
run_cmd("go version")
run_cmd("go test -v -run=TestTraceback ./... > test.log")
run_cmd(f"go test -v{ext_flag}-run=TestTraceback ./... > test.log")
run_cmd("grep -q \"runtime: \" test.log && exit 1 || exit 0")

clear_files()
Expand Down

0 comments on commit 3b15887

Please sign in to comment.