From cbd5e8ba01a8d35c6015f32d1e00b598bb097ffa Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 26 Jun 2021 16:09:04 +0200 Subject: tests/default: add maxlen.bash test --- tests/defaults/main_test.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go index e7e065e..4e5ffea 100644 --- a/tests/defaults/main_test.go +++ b/tests/defaults/main_test.go @@ -318,9 +318,9 @@ read(3, "M:\tSylwester Nawrocki \nL:\tlinux"..., 32768) = 32768 -read(3, "ach-spear3xx/\n\nSPEAR6XX MACHINE "..., 32768) = 32768 +read(3, "ach-spear3xx/\n\nSPEAR6XX MACHINE "..., 32768) = 32768 <--- WRONG LENGTH!!! read(3, "", 32768) = 0 -lseek(3, 0, SEEK_CUR) = 196608 +lseek(3, 0, SEEK_CUR) = 196608 <--- WRONG LENGTH!!! close(3) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x2), ...}) = 0 write(1, "279b6ab0491e7532132e8f32afe6c04d"..., 56279b6ab0491e7532132e8f32afe6c04d linux-3.0/MAINTAINERS @@ -373,3 +373,27 @@ func TestMd5sumMaintainers(t *testing.T) { t.Logf("full output:\n%s", out) } } + +func TestMaxlen(t *testing.T) { + workDir := filepath.Join(test_helpers.DefaultPlainDir, t.Name()) + if err := os.Mkdir(workDir, 0700); err != nil { + t.Fatal(err) + } + cmd := exec.Command("../../contrib/maxlen.bash", workDir) + out, err := cmd.CombinedOutput() + if err != nil { + t.Log(string(out)) + t.Fatal(err) + } + want := ` + Maximum filename length: 255 + Maximum dirname length: 255 + Maximum path length with 1 chars per subdir: 4095 + Maximum path length with 10 chars per subdir: 4095 + Maximum path length with 100 chars per subdir: 4095 + Maximum path length with 255 chars per subdir: 4095 +` + if !strings.HasSuffix(string(out), want) { + t.Errorf("wrong output: %s", string(out)) + } +} -- cgit v1.2.3