Skip to content

Commit c0545ae

Browse files
committed
chore: probe v2
1 parent eb22d7c commit c0545ae

1 file changed

Lines changed: 18 additions & 36 deletions

File tree

.github/workflows/probe2604.yml

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,23 @@ name: probe2604
22
on: [push]
33
jobs:
44
probe:
5-
runs-on: ${{ matrix.os }}
6-
strategy:
7-
fail-fast: false
8-
matrix:
9-
os: [ubuntu-24.04, ubuntu-26.04]
5+
runs-on: ubuntu-26.04
106
steps:
11-
- run: |
12-
uname -a
13-
for d in / /home/runner/work /home/runner /tmp /var/tmp /mnt; do
14-
printf '%s -> %s\n' "$d" "$(stat -f -c %T "$d" 2>/dev/null)"
15-
done
16-
findmnt -o TARGET,SOURCE,FSTYPE | head -30
17-
- name: repro
7+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8+
with:
9+
ref: cod-3089-collect-rss-in-memtrack
10+
- name: repro fixture exactly
1811
run: |
19-
mkdir -p "$HOME/work/probe/target/tmp"
20-
cat > /tmp/r.c <<'EOF'
21-
#include <stdio.h>
22-
#include <stdlib.h>
23-
#include <string.h>
24-
#include <sys/mman.h>
25-
#include <unistd.h>
26-
int main(int argc, char** argv) {
27-
size_t len = 64UL*1024*1024;
28-
char t[4096]; snprintf(t, sizeof t, "%s/probe-XXXXXX", argv[1]);
29-
int fd = mkstemp(t); if (fd < 0) return 1; unlink(t);
30-
char c[65536]; memset(c, 0x42, sizeof c);
31-
for (size_t o = 0; o < len; o += sizeof c) if (write(fd, c, sizeof c) < 0) return 1;
32-
void* m = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
33-
if (m == MAP_FAILED) return 1;
34-
volatile char s = 0;
35-
for (size_t i = 0; i < len; i += 4096) s ^= ((volatile char*)m)[i];
36-
FILE* f = fopen("/proc/self/status", "r"); char line[256];
37-
while (fgets(line, sizeof line, f)) if (strstr(line, "Rss") || strstr(line, "VmHWM")) fputs(line, stdout);
38-
return s & 0;
39-
}
40-
EOF
41-
gcc -O0 -o /tmp/r /tmp/r.c
42-
for d in "$HOME/work/probe/target/tmp" /var/tmp /tmp; do echo "== $d ($(stat -f -c %T $d))"; /tmp/r "$d"; done
12+
set -x
13+
d="$PWD/target/tmp/probe"
14+
mkdir -p "$d"
15+
stat -f -c '%T %n' "$d" "$PWD" /tmp
16+
echo "TMPDIR=${TMPDIR-unset}"
17+
cd crates/memtrack
18+
gcc -O0 -I testdata/rss -o /tmp/fixture testdata/rss/file.c
19+
/tmp/fixture "$d/file.report"; echo "exit=$?"
20+
cat "$d/file.report"
21+
echo "--- as root"
22+
sudo /tmp/fixture "$d/file2.report"; cat "$d/file2.report"
23+
echo "--- in /tmp"
24+
/tmp/fixture /tmp/file3.report; cat /tmp/file3.report

0 commit comments

Comments
 (0)