File: qa-lfs

package info (click to toggle)
newlisp 10.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 6,248 kB
  • sloc: ansic: 33,280; lisp: 4,181; sh: 609; makefile: 215
file content (41 lines) | stat: -rwxr-xr-x 1,144 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env newlisp

;; Test for LFS (Large Files Support)
;; create a file with more than 2^32 bytes
;; and read back some records for verification
;; Needs approximately 5 Gigabyte of diskspace
;; writing a file of 5,000,000 records of 1k each.

(println)
(println "This test for LFS (Large Files Support) takes a long time to run.")
(println "It writes 5 Million records to a 5 Gigabyte filei, then reads back.")
(println)
(print "You really want to run this test y/n ? ")
(if (not (starts-with (read-line) "y" 1))
	(exit))

(set 'file (open "largefile" "write"))

(dotimes (i 5000000)
	(set 'rec (append (format "%08d" i) (dup "#" 992)))
	(write-buffer file rec 1000)
	(if (= 0 (% i 10000)) (print (format "%10d KB of 5000000 KB written \r" i)))
)
(close file)

(println)

(set 'file (open "largefile" "read"))

(for (i 0 4999999 10000)
	(set 'test (append (format "%08d" i) (dup "#" 992)))
    (seek file (mul i 1000))
	(read-buffer file rec 1000)
	(if (= test rec) 
		(print (format "%8d record -> Ok\r" i) (0 8 rec))
		(println i " record -> Error reading " (0 8 rec)))
)	

(printlni ">>>>> tested Large file system support")
(exit)