3 """Automated tests of the apt-p2p functionality.
5 This script runs several automatic tests of some of the functionality in
8 @type tests: C{dictionary}
9 @var tests: all of the tests that can be run.
10 The keys are the test names (strings) which are used on the command-line
11 to identify the tests (can not be 'all' or 'help'). The values are tuples
12 with four elements: a description of the test (C{string}), the bootstrap
13 nodes to start (C{dictionary}), the downloaders to start (C{dictionary},
14 and the apt-get commands to run (C{list}).
16 The bootstrap nodes keys are integers, which must be in the range 1-9.
17 The values are the dictionary of keyword options to pass to the function
18 that starts the bootstrap node (see L{start_bootstrap} below).
20 The downloaders keys are also integers in the range 1-99. The values are
21 the dictionary of keyword options to pass to the function
22 that starts the downloader node (see L{start_downloader} below).
24 The apt-get commands' list elements are tuples with 2 elements: the
25 downloader to run the command on, and the list of command-line
26 arguments to specify to the apt-get program.
29 @var CWD: the working directory the script was run from
30 @type apt_conf_template: C{string}
31 @var apt_conf_template: the template to use for the apt.conf file
35 from time import sleep, time
36 import sys, os, signal
37 from traceback import print_exc
38 from os.path import exists
40 tests = {'1': ('Start a single bootstrap and downloader, test updating and downloading ' +
45 (1, ['install', 'aboot-base']),
46 (1, ['install', 'aap-doc']),
47 (1, ['install', 'ada-reference-manual']),
48 (1, ['install', 'aspectj-doc']),
49 (1, ['install', 'fop-doc']),
50 (1, ['install', 'jswat-doc']),
51 (1, ['install', 'asis-doc']),
52 (1, ['install', 'bison-doc']),
53 (1, ['install', 'crash-whitepaper']),
56 '2': ('Start a single bootstrap and 2 downloaders to test downloading from a peer.',
62 (1, ['install', 'aboot-base']),
63 (2, ['install', 'aboot-base']),
64 (1, ['install', 'aap-doc']),
65 (1, ['install', 'ada-reference-manual']),
66 (1, ['install', 'fop-doc']),
67 (1, ['install', 'jswat-doc']),
68 (1, ['install', 'bison-doc']),
69 (1, ['install', 'crash-whitepaper']),
70 (2, ['install', 'aap-doc']),
71 (2, ['install', 'ada-reference-manual']),
72 (2, ['install', 'fop-doc']),
73 (2, ['install', 'jswat-doc']),
74 (2, ['install', 'bison-doc']),
75 (2, ['install', 'crash-whitepaper']),
78 '3': ('Start a single bootstrap and 6 downloaders, to test downloading' +
79 ' speeds from each other.',
88 (1, ['install', 'aboot-base']),
89 (1, ['install', 'ada-reference-manual']),
90 (1, ['install', 'fop-doc']),
91 (1, ['install', 'crash-whitepaper']),
93 (2, ['install', 'aboot-base']),
94 (2, ['install', 'ada-reference-manual']),
95 (2, ['install', 'fop-doc']),
96 (2, ['install', 'crash-whitepaper']),
98 (3, ['install', 'aboot-base']),
99 (3, ['install', 'ada-reference-manual']),
100 (3, ['install', 'fop-doc']),
101 (3, ['install', 'crash-whitepaper']),
103 (4, ['install', 'aboot-base']),
104 (4, ['install', 'ada-reference-manual']),
105 (4, ['install', 'fop-doc']),
106 (4, ['install', 'crash-whitepaper']),
108 (5, ['install', 'aboot-base']),
109 (5, ['install', 'ada-reference-manual']),
110 (5, ['install', 'fop-doc']),
111 (5, ['install', 'crash-whitepaper']),
113 (6, ['install', 'aboot-base']),
114 (6, ['install', 'ada-reference-manual']),
115 (6, ['install', 'fop-doc']),
116 (6, ['install', 'crash-whitepaper']),
119 '4': ('Start a single bootstrap and 1 downloader, requesting the same' +
120 ' packages multiple times to test caching.',
124 (1, ['install', 'aboot-base']),
125 (1, ['install', 'ada-reference-manual']),
126 (1, ['install', 'fop-doc']),
127 (1, ['install', 'crash-whitepaper']),
129 (1, ['install', 'aboot-base']),
130 (1, ['install', 'ada-reference-manual']),
131 (1, ['install', 'fop-doc']),
132 (1, ['install', 'crash-whitepaper']),
134 (1, ['install', 'aboot-base']),
135 (1, ['install', 'ada-reference-manual']),
136 (1, ['install', 'fop-doc']),
137 (1, ['install', 'crash-whitepaper']),
140 '5': ('Start a single bootstrap and 6 downloaders, update all to test' +
141 ' that they can all see each other.',
143 {1: ([], {'suites': 'contrib non-free'}),
144 2: ([], {'suites': 'contrib non-free'}),
145 3: ([], {'suites': 'contrib non-free'}),
146 4: ([], {'suites': 'contrib non-free'}),
147 5: ([], {'suites': 'contrib non-free'}),
148 6: ([], {'suites': 'contrib non-free'})},
157 '6': ('Test caching with multiple apt-get updates.',
166 '7': ('Test pipelining of multiple simultaneous downloads.',
170 (1, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
171 'aspectj-doc', 'fop-doc', 'asis-doc',
172 'bison-doc', 'crash-whitepaper',
173 'bash-doc', 'apt-howto-common', 'autotools-dev',
174 'aptitude-doc-en', 'asr-manpages',
175 'atomix-data', 'alcovebook-sgml-doc',
176 'afbackup-common', 'airstrike-common',
180 '8': ('Test pipelining of multiple simultaneous downloads with many peers.',
189 (1, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
190 'aspectj-doc', 'fop-doc', 'asis-doc',
191 'bison-doc', 'crash-whitepaper',
192 'bash-doc', 'apt-howto-common', 'autotools-dev',
193 'aptitude-doc-en', 'asr-manpages',
194 'atomix-data', 'alcovebook-sgml-doc',
195 'afbackup-common', 'airstrike-common',
198 (2, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
199 'aspectj-doc', 'fop-doc', 'asis-doc',
200 'bison-doc', 'crash-whitepaper',
201 'bash-doc', 'apt-howto-common', 'autotools-dev',
202 'aptitude-doc-en', 'asr-manpages',
203 'atomix-data', 'alcovebook-sgml-doc',
204 'afbackup-common', 'airstrike-common',
207 (3, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
208 'aspectj-doc', 'fop-doc', 'asis-doc',
209 'bison-doc', 'crash-whitepaper',
210 'bash-doc', 'apt-howto-common', 'autotools-dev',
211 'aptitude-doc-en', 'asr-manpages',
212 'atomix-data', 'alcovebook-sgml-doc',
213 'afbackup-common', 'airstrike-common',
216 (4, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
217 'aspectj-doc', 'fop-doc', 'asis-doc',
218 'bison-doc', 'crash-whitepaper',
219 'bash-doc', 'apt-howto-common', 'autotools-dev',
220 'aptitude-doc-en', 'asr-manpages',
221 'atomix-data', 'alcovebook-sgml-doc',
222 'afbackup-common', 'airstrike-common',
225 (5, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
226 'aspectj-doc', 'fop-doc', 'asis-doc',
227 'bison-doc', 'crash-whitepaper',
228 'bash-doc', 'apt-howto-common', 'autotools-dev',
229 'aptitude-doc-en', 'asr-manpages',
230 'atomix-data', 'alcovebook-sgml-doc',
231 'afbackup-common', 'airstrike-common',
234 (6, ['install', 'aboot-base', 'aap-doc', 'ada-reference-manual',
235 'aspectj-doc', 'fop-doc', 'asis-doc',
236 'bison-doc', 'crash-whitepaper',
237 'bash-doc', 'apt-howto-common', 'autotools-dev',
238 'aptitude-doc-en', 'asr-manpages',
239 'atomix-data', 'alcovebook-sgml-doc',
240 'afbackup-common', 'airstrike-common',
244 '9': ('Start a single bootstrap and 6 downloaders and test downloading' +
245 ' a very large file.',
254 (1, ['install', 'kde-icons-oxygen']),
256 (2, ['install', 'kde-icons-oxygen']),
258 (3, ['install', 'kde-icons-oxygen']),
260 (4, ['install', 'kde-icons-oxygen']),
262 (5, ['install', 'kde-icons-oxygen']),
264 (6, ['install', 'kde-icons-oxygen']),
269 assert 'all' not in tests
270 assert 'help' not in tests
273 apt_conf_template = """
275 // Location of the state dir
280 userstatus "status.user";
281 cdroms "cdroms.list";
284 // Location of the cache dir
285 Cache "var/cache/apt/" {
286 Archives "archives/";
287 srcpkgcache "srcpkgcache.bin";
288 pkgcache "pkgcache.bin";
293 SourceList "sources.list";
295 Preferences "preferences";
299 // Locations of binaries
301 methods "/usr/lib/apt/methods/";
304 dpkg "/usr/bin/dpkg --simulate";
305 dpkg-source "/usr/bin/dpkg-source";
306 dpkg-buildpackage "/usr/bin/dpkg-buildpackage";
307 apt-get "/usr/bin/apt-get";
308 apt-cache "/usr/bin/apt-cache";
312 /* Options you can set to see some debugging text They correspond to names
313 of classes in the source code */
316 pkgProblemResolver "false";
317 pkgDepCache::AutoInstall "false"; // what packages apt install to satify dependencies
319 pkgAcquire::Worker "false";
320 pkgAcquire::Auth "false";
322 pkgDPkgProgressReporting "false";
323 pkgOrderList "false";
326 pkgInitialize "false"; // This one will dump the configuration space
328 Acquire::Ftp "false"; // Show ftp command traffic
329 Acquire::Http "false"; // Show http command traffic
330 Acquire::gpgv "false"; // Show the gpgv traffic
331 aptcdrom "false"; // Show found package files
336 apt_p2p_conf_template = """
339 # Port to listen on for all requests (TCP and UDP)
342 # The rate to limit sending data to peers to, in KBytes/sec.
343 # Set this to 0 to not limit the upload bandwidth.
346 # The minimum number of peers before the mirror is not used.
347 # If there are fewer peers than this for a file, the mirror will also be
348 # used to speed up the download. Set to 0 to never use the mirror if
350 MIN_DOWNLOAD_PEERS = 3
352 # Directory to store the downloaded files in
353 CACHE_DIR = %(CACHE_DIR)s
355 # Other directories containing packages to share with others
356 # WARNING: all files in these directories will be hashed and available
357 # for everybody to download
360 # User name to try and run as
363 # Whether it's OK to use an IP addres from a known local/private range
366 # Unload the packages cache after an interval of inactivity this long.
367 # The packages cache uses a lot of memory, and only takes a few seconds
368 # to reload when a new request arrives.
369 UNLOAD_PACKAGES_CACHE = 5m
371 # Refresh the DHT keys after this much time has passed.
372 # This should be a time slightly less than the DHT's KEY_EXPIRE value.
375 # Which DHT implementation to use.
376 # It must be possile to do "from <DHT>.DHT import DHT" to get a class that
377 # implements the IDHT interface.
378 DHT = apt_p2p_Khashmir
380 # Whether to only run the DHT (for providing only a bootstrap node)
381 DHT-ONLY = %(DHT-ONLY)s
384 # bootstrap nodes to contact to join the DHT
385 BOOTSTRAP = %(BOOTSTRAP)s
387 # whether this node is a bootstrap node
388 BOOTSTRAP_NODE = %(BOOTSTRAP_NODE)s
390 # Kademlia "K" constant, this should be an even number
393 # SHA1 is 160 bits long
396 # checkpoint every this many seconds
397 CHECKPOINT_INTERVAL = 5m
399 # concurrent xmlrpc calls per find node/value request!
402 # how many hosts to post to
405 # How many values to attempt to retrieve from the DHT.
406 # Setting this to 0 will try and get all values (which could take a while if
407 # a lot of nodes have values). Setting it negative will try to get that
408 # number of results from only the closest STORE_REDUNDANCY nodes to the hash.
409 # The default is a large negative number so all values from the closest
410 # STORE_REDUNDANCY nodes will be retrieved.
411 RETRIEVE_VALUES = -10000
413 # how many times in a row a node can fail to respond before it's booted from the routing table
416 # never ping a node more often than this
417 MIN_PING_INTERVAL = 15m
419 # refresh buckets that haven't been touched in this long
420 BUCKET_STALENESS = 1h
422 # expire entries older than this
425 # whether to spew info about the requests/responses in the protocol
430 """Remove all the files and directories below a top-level one.
433 @param top: the top-level directory to start at
437 for root, dirs, files in os.walk(top, topdown=False):
439 os.remove(os.path.join(root, name))
441 os.rmdir(os.path.join(root, name))
444 """Join together a list of directories into a path string.
446 @type dir: C{list} of C{string}
447 @param dir: the path to join together
449 @return: the joined together path
455 joined = os.path.join(joined, i)
459 """Create all the directories to make a path.
461 @type dir: C{list} of C{string}
462 @param dir: the path to create
465 if not os.path.exists(join(dir)):
466 os.makedirs(join(dir))
469 """Create an empty file.
471 @type path: C{list} of C{string}
472 @param path: the path to create
476 f = open(join(path), 'w')
479 def start(cmd, args, work_dir = None):
480 """Fork and start a background process running.
483 @param cmd: the name of the command to run
484 @type args: C{list} of C{string}
485 @param args: the argument to pass to the command
486 @type work_dir: C{string}
487 @param work_dir: the directory to change to to execute the child process in
488 (optional, defaults to the current directory)
490 @return: the PID of the forked process
494 new_cmd = [cmd] + args
495 pid = os.spawnvp(os.P_NOWAIT, new_cmd[0], new_cmd)
499 """Stop a forked background process that is running.
502 @param pid: the PID of the process to stop
504 @return: the return status code from the child
508 # First try a keyboard interrupt
509 os.kill(pid, signal.SIGINT)
512 (r_pid, r_value) = os.waitpid(pid, os.WNOHANG)
516 # Try a keyboard interrupt again, just in case
517 os.kill(pid, signal.SIGINT)
520 (r_pid, r_value) = os.waitpid(pid, os.WNOHANG)
525 os.kill(pid, signal.SIGTERM)
528 (r_pid, r_value) = os.waitpid(pid, os.WNOHANG)
532 # Finally a kill, don't return until killed
533 os.kill(pid, signal.SIGKILL)
536 (r_pid, r_value) = os.waitpid(pid, os.WNOHANG)
540 def apt_get(num_down, cmd):
541 """Start an apt-get process in the background.
543 The default argument specified to the apt-get invocation are
544 'apt-get -d -q -c <conf_file>'. Any additional arguments (including
545 the apt-get action to use) should be specified.
547 @type num_down: C{int}
548 @param num_down: the number of the downloader to use
549 @type cmd: C{list} of C{string}
550 @param cmd: the arguments to pass to the apt-get process
552 @return: the PID of the background process
556 print '*************** apt-get (' + str(num_down) + ') ' + ' '.join(cmd) + ' ****************'
557 apt_conf = join([down_dir(num_down), 'etc', 'apt', 'apt.conf'])
558 dpkg_status = join([down_dir(num_down), 'var', 'lib', 'dpkg', 'status'])
559 args = ['-d', '-c', apt_conf, '-o', 'Dir::state::status='+dpkg_status] + cmd
560 pid = start('apt-get', args)
563 def bootstrap_address(num_boot):
564 """Determine the bootstrap address to use for a node.
566 @type num_boot: C{int}
567 @param num_boot: the number of the bootstrap node
569 @return: the bootstrap address to use
573 return 'localhost:1' + str(num_boot) + '969'
575 def down_dir(num_down):
576 """Determine the working directory to use for a downloader.
578 @type num_down: C{int}
579 @param num_down: the number of the downloader
581 @return: the downloader's directory
585 return os.path.join(CWD,'downloader' + str(num_down))
587 def boot_dir(num_boot):
588 """Determine the working directory to use for a bootstrap node.
590 @type num_boot: C{int}
591 @param num_boot: the number of the bootstrap node
593 @return: the bootstrap node's directory
597 return os.path.join(CWD,'bootstrap' + str(num_boot))
599 def start_downloader(bootstrap_addresses, num_down, options = {},
600 mirror = 'ftp.us.debian.org/debian',
601 suites = 'main contrib non-free', clean = True):
602 """Initialize a new downloader process.
604 The default arguments specified to the downloader invocation are
605 the configuration directory, apt port, minport, maxport and the
607 Any additional arguments needed should be specified by L{options}.
609 @type num_down: C{int}
610 @param num_down: the number of the downloader to use
611 @type options: C{dictionary}
612 @param options: the dictionary of string formatting values for creating
613 the apt-p2p configuration file (see L{apt_p2p_conf_template} above).
614 (optional, defaults to only using the default arguments)
615 @type mirror: C{string}
616 @param mirror: the Debian mirror to use
617 (optional, defaults to 'ftp.us.debian.org/debian')
618 @type suites: C{string}
619 @param suites: space separated list of suites to download
620 (optional, defaults to 'main contrib non-free')
621 @type clean: C{boolean}
622 @param clean: whether to remove any previous downloader files
623 (optional, defaults to removing them)
625 @return: the PID of the downloader process
629 assert num_down < 100
631 print '************************** Starting Downloader ' + str(num_down) + ' **************************'
633 downloader_dir = down_dir(num_down)
641 # Create the directory structure needed by apt
642 makedirs([downloader_dir, 'etc', 'apt', 'apt.conf.d'])
643 makedirs([downloader_dir, 'var', 'lib', 'apt', 'lists', 'partial'])
644 makedirs([downloader_dir, 'var', 'lib', 'dpkg'])
645 makedirs([downloader_dir, 'var', 'cache', 'apt', 'archives', 'partial'])
646 touch([downloader_dir, 'var', 'lib', 'apt', 'lists', 'lock'])
647 touch([downloader_dir, 'var', 'lib', 'dpkg', 'lock'])
648 touch([downloader_dir, 'var', 'lib', 'dpkg', 'status'])
649 touch([downloader_dir, 'var', 'cache', 'apt', 'archives', 'lock'])
651 # Create apt's config files
652 f = open(join([downloader_dir, 'etc', 'apt', 'sources.list']), 'w')
653 f.write('deb http://localhost:1%02d77/%s/ unstable %s\n' % (num_down, mirror, suites))
656 f = open(join([downloader_dir, 'etc', 'apt', 'apt.conf']), 'w')
657 f.write('Dir "' + downloader_dir + '"')
658 f.write(apt_conf_template)
661 defaults = {'PORT': '1%02d77' % num_down,
662 'CACHE_DIR': downloader_dir,
664 'BOOTSTRAP': bootstrap_addresses,
665 'BOOTSTRAP_NODE': 'no'}
668 defaults[k] = options[k]
669 f = open(join([downloader_dir, 'apt-p2p.conf']), 'w')
670 f.write(apt_p2p_conf_template % defaults)
673 pid = start('python', [join([sys.path[0], 'apt-p2p.py']),
674 '--config-file=' + join([downloader_dir, 'apt-p2p.conf']),
675 '--log-file=' + join([downloader_dir, 'apt-p2p.log']),],
679 def start_bootstrap(bootstrap_addresses, num_boot, options = [], clean = True):
680 """Initialize a new bootstrap node process.
682 The default arguments specified to the apt-p2p invocation are
683 the state file and port to use. Any additional arguments needed
684 should be specified by L{options}.
686 @type num_boot: C{int}
687 @param num_boot: the number of the bootstrap node to use
688 @type options: C{list} of C{string}
689 @param options: the arguments to pass to the bootstrap node
690 (optional, defaults to only using the default arguments)
691 @type clean: C{boolean}
692 @param clean: whether to remove any previous bootstrap node files
693 (optional, defaults to removing them)
695 @return: the PID of the downloader process
701 print '************************** Starting Bootstrap ' + str(num_boot) + ' **************************'
703 bootstrap_dir = boot_dir(num_boot)
711 makedirs([bootstrap_dir])
713 defaults = {'PORT': '1%d969' % num_boot,
714 'CACHE_DIR': bootstrap_dir,
716 'BOOTSTRAP': bootstrap_addresses,
717 'BOOTSTRAP_NODE': 'yes'}
720 defaults[k] = options[k]
721 f = open(join([bootstrap_dir, 'apt-p2p.conf']), 'w')
722 f.write(apt_p2p_conf_template % defaults)
725 pid = start('python', [join([sys.path[0], 'apt-p2p.py']),
726 '--config-file=' + join([bootstrap_dir, 'apt-p2p.conf']),
727 '--log-file=' + join([bootstrap_dir, 'apt-p2p.log']),],
732 def run_test(bootstraps, downloaders, apt_get_queue):
733 """Run a single test.
735 @type bootstraps: C{dictionary} of {C{int}: C{list} of C{string}}
736 @param bootstraps: the bootstrap nodes to start, keys are the bootstrap numbers and
737 values are the list of options to invoke the bootstrap node with
738 @type downloaders: C{dictionary} of {C{int}: (C{int}, C{list} of C{string})}
739 @param downloaders: the downloaders to start, keys are the downloader numbers and
740 values are the list of options to invoke the downloader with
741 @type apt_get_queue: C{list} of (C{int}, C{list} of C{string})
742 @param apt_get_queue: the apt-get downloader to use and commands to execute
743 @rtype: C{list} of (C{float}, C{int})
744 @return: the execution time and returned status code for each element of apt_get_queue
748 running_bootstraps = {}
749 running_downloaders = {}
754 boot_keys = bootstraps.keys()
756 bootstrap_addresses = bootstrap_address(boot_keys[0])
757 for i in xrange(1, len(boot_keys)):
758 bootstrap_addresses += '\n ' + bootstrap_address(boot_keys[i])
760 for k, v in bootstraps.items():
761 running_bootstraps[k] = start_bootstrap(bootstrap_addresses, k, **v)
765 for k, v in downloaders.items():
766 running_downloaders[k] = start_downloader(bootstrap_addresses, k, **v)
770 for (num_down, cmd) in apt_get_queue:
771 running_apt_get[num_down] = apt_get(num_down, cmd)
773 (pid, r_value) = os.waitpid(running_apt_get[num_down], 0)
774 elapsed = time() - start_time
775 del running_apt_get[num_down]
776 r_value = r_value / 256
777 apt_get_results.append((elapsed, r_value))
780 print '********** apt-get completed successfully in ' + str(elapsed) + ' sec. *****************'
782 print '********** apt-get finished with status ' + str(r_value) + ' in ' + str(elapsed) + ' sec. ************'
787 print '************************** Exception occurred **************************'
789 print '************************** will attempt to shut down *******************'
791 print '*********************** shutting down the apt-gets *******************'
792 for k, v in running_apt_get.items():
794 print 'apt-get', k, stop(v)
796 print '************************** Exception occurred **************************'
801 print '*********************** shutting down the downloaders *******************'
802 for k, v in running_downloaders.items():
804 print 'downloader', k, stop(v)
806 print '************************** Exception occurred **************************'
811 print '************************** shutting down the bootstraps *******************'
812 for k, v in running_bootstraps.items():
814 print 'bootstrap', k, stop(v)
816 print '************************** Exception occurred **************************'
819 print '************************** Test Results *******************'
821 for (num_down, cmd) in apt_get_queue:
823 s = str(num_down) + ': "apt-get ' + ' '.join(cmd) + '" '
824 if len(apt_get_results) > i:
825 (elapsed, r_value) = apt_get_results[i]
826 s += 'took ' + str(elapsed) + ' secs (' + str(r_value) + ')'
828 s += 'did not complete'
831 return apt_get_results
834 """Get the usage information to display to the user.
837 @return: the usage information to display
841 s = 'Usage: ' + sys.argv[0] + ' (all|<test>|help)\n\n'
842 s += ' all - run all the tests\n'
843 s += ' help - display this usage information\n'
844 s += ' <test> - run the <test> test (see list below for valid tests)\n\n'
849 s += 'test "' + str(k) + '" - ' + v[0] + '\n'
853 if __name__ == '__main__':
854 if len(sys.argv) != 2:
856 elif sys.argv[1] == 'all':
857 for k, v in tests.items():
858 run_test(v[1], v[2], v[3])
859 elif sys.argv[1] in tests:
860 v = tests[sys.argv[1]]
861 run_test(v[1], v[2], v[3])
862 elif sys.argv[1] == 'help':
865 print 'Unknown test to run:', sys.argv[1], '\n'