File: args.test.py

package info (click to toggle)
tarantool 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 85,364 kB
  • sloc: ansic: 513,760; cpp: 69,489; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,173; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (62 lines) | stat: -rw-r--r-- 2,619 bytes parent folder | download | duplicates (3)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import sys
import os
import re

# Disabled on OpenBSD due to fail #XXXX.
import platform

if platform.system() == 'OpenBSD':
    self.skip = 1

# mask BFD warnings: https://bugs.launchpad.net/tarantool/+bug/1018356
sys.stdout.push_filter("unable to read unknown load command 0x2\d+", "")
server.test_option("--help")
server.test_option("-h")
# Replace with the same value for case when builddir inside source dir
sys.stdout.push_filter(re.escape(os.getenv("BUILDDIR")+'/src/tarantool'), "tarantool")
sys.stdout.push_filter(re.escape(os.getenv("BUILDDIR")), "${SOURCEDIR}")
sys.stdout.push_filter(re.escape(os.getenv("SOURCEDIR")+'/src/tarantool'), "tarantool")
sys.stdout.push_filter(re.escape(os.getenv("SOURCEDIR")), "${SOURCEDIR}")
sys.stdout.push_filter("invalid option.*", "invalid option")
sys.stdout.push_filter("unrecognized option.*", "unrecognized option")
server.test_option("-Z")
server.test_option("--no-such-option")
server.test_option("--no-such-option --version")
sys.stdout.push_filter(".* (\d+)\.\d+\.\d(-\d+-\w+)?", "Tarantool \\1.minor.patch-<rev>-<commit>")
sys.stdout.push_filter("Target: .*", "Target: platform <build>")
sys.stdout.push_filter(".*Disable shared arena since.*\n", "")
sys.stdout.push_filter("Build options: .*", "Build options: flags")
sys.stdout.push_filter("C_FLAGS:.*", "C_FLAGS: flags")
sys.stdout.push_filter("CXX_FLAGS:.*", "CXX_FLAGS: flags")
sys.stdout.push_filter("Compiler: .*", "Compiler: cc")

server.test_option("--version")
server.test_option("-v")
server.test_option("-V          ")

script = os.getenv("SOURCEDIR") + "/test/box-py/args.lua"
server.test_option(script)
server.test_option(script + " 1 2 3")
server.test_option(script + " 1 2 3 -V")
server.test_option(script + " -V 1 2 3")
server.test_option(script + " 1 2 3 --help")
server.test_option(script + " --help 1 2 3")
server.test_option("-V " + script + " 1 2 3")

# gh-3966: os.exit() hangs if called by a command from the argument list.
server.test_option("-e \"print(1) os.exit() print(2)\"")
server.test_option("-e \"print(1)\" -e \"os.exit()\" -e \"print(1)\" -e \"os.exit()\" -e \"print(1)\"")

server.test_option("-e \"print('Hello')\" " + script + " 1 2 3")
server.test_option("-e \"a = 10\" " + \
                   "-e print(a) " + \
                   script + \
                   " 1 2 3 --help")
server.test_option("-e \"print(rawget(_G, 'log') == nil)\" " + \
                   "-e io.flush() " + \
                   "-l log " + \
                   "-e \"print(log.info('Hello'))\" " + \
                   script + \
                   " 1 2 3 --help")

sys.stdout.clear_all_filters()