bin/test_backend_sizes.py fix compile flags and s3 reporting

This now compiles rclone with CGO_ENABLED=0 which is closer to the
release compile.

It also removes pikpak if testing s3 as the two depend on each
other.
This commit is contained in:
Nick Craig-Wood 2024-12-12 16:56:35 +00:00
parent 6a983d601c
commit 6ade1055d5

View File

@ -7,15 +7,18 @@ Run with no arguments to test all backends or a supply a list of
backends to test.
"""
import os
import re
import sys
import subprocess
all_backends = "backend/all/all.go"
# compile command which is more or less like the production builds
compile_command = ["go", "build", "--ldflags", "-s", "-trimpath"]
import os
import re
import sys
import subprocess
# disable CGO as that makes a lot of difference to binary size
os.environ["CGO_ENABLED"]="0"
match_backend = re.compile(r'"github.com/rclone/rclone/backend/(.*?)"')
@ -43,6 +46,9 @@ def write_all(orig_all, backend):
# Comment out line matching backend
if match and match.group(1) == backend:
line = "// " + line
# s3 and pikpak depend on each other
if backend == "s3" and "pikpak" in line:
line = "// " + line
fd.write(line+"\n")
def compile():