Commit ffaff18
selftests/bpf: improve error messages in veristat
Return error if preset parsing fails. Avoid proceeding with veristat run
if preset does not parse.
Before:
```
./veristat set_global_vars.bpf.o -G "arr[999999999999999999999] = 1"
Failed to parse value '999999999999999999999'
Processing 'set_global_vars.bpf.o'...
File Program Verdict Duration (us) Insns States Program size Jited size
--------------------- ---------------- ------- ------------- ----- ------ ------------ ----------
set_global_vars.bpf.o test_set_globals success 27 64 0 82 0
--------------------- ---------------- ------- ------------- ----- ------ ------------ ----------
Done. Processed 1 files, 0 programs. Skipped 1 files, 0 programs.
```
After:
```
./veristat set_global_vars.bpf.o -G "arr[999999999999999999999] = 1"
Failed to parse value '999999999999999999999'
Failed to parse global variable presets: arr[999999999999999999999] = 1
```
Improve error messages:
* If preset struct member can't be found.
* Array index out of bounds
Extract rtrim function.
Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20250627144342.686896-1-mykyta.yatsenko5@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>1 parent bacdf5a commit ffaff18
1 file changed
+25
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
893 | 905 | | |
894 | 906 | | |
895 | 907 | | |
| |||
1666 | 1678 | | |
1667 | 1679 | | |
1668 | 1680 | | |
1669 | | - | |
| 1681 | + | |
1670 | 1682 | | |
1671 | 1683 | | |
1672 | 1684 | | |
| |||
1677 | 1689 | | |
1678 | 1690 | | |
1679 | 1691 | | |
1680 | | - | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
1681 | 1695 | | |
1682 | 1696 | | |
1683 | 1697 | | |
1684 | 1698 | | |
1685 | 1699 | | |
1686 | 1700 | | |
1687 | 1701 | | |
1688 | | - | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
1689 | 1705 | | |
1690 | 1706 | | |
1691 | 1707 | | |
| |||
1697 | 1713 | | |
1698 | 1714 | | |
1699 | 1715 | | |
1700 | | - | |
| 1716 | + | |
1701 | 1717 | | |
1702 | 1718 | | |
1703 | 1719 | | |
| |||
1712 | 1728 | | |
1713 | 1729 | | |
1714 | 1730 | | |
1715 | | - | |
1716 | | - | |
1717 | | - | |
1718 | | - | |
1719 | | - | |
| 1731 | + | |
1720 | 1732 | | |
1721 | 1733 | | |
1722 | 1734 | | |
| |||
1869 | 1881 | | |
1870 | 1882 | | |
1871 | 1883 | | |
1872 | | - | |
| 1884 | + | |
1873 | 1885 | | |
1874 | 1886 | | |
1875 | 1887 | | |
| |||
1928 | 1940 | | |
1929 | 1941 | | |
1930 | 1942 | | |
1931 | | - | |
| 1943 | + | |
1932 | 1944 | | |
1933 | 1945 | | |
1934 | 1946 | | |
| |||
1955 | 1967 | | |
1956 | 1968 | | |
1957 | 1969 | | |
| 1970 | + | |
| 1971 | + | |
1958 | 1972 | | |
1959 | 1973 | | |
1960 | 1974 | | |
| |||
0 commit comments