OILS / test / configure-effects.sh View on Github | oils.pub

82 lines, 31 significant
1#!/usr/bin/env bash
2#
3# What happens if various build features aren't detected?
4# In Python and C++
5#
6# Usage:
7# test/configure-effects.sh <function name>
8
9set -o nounset
10set -o pipefail
11set -o errexit
12
13# bugs:
14# echo | tr
15# echo | cat
16# history | less
17
18prepare-cpp() {
19 ./NINJA-config.sh
20
21 # This overwrites the config
22 ./configure --without-readline --without-libc-features --without-systemtap-sdt
23
24 ninja
25}
26
27prepare-py() {
28 make
29}
30
31test-osh() {
32 local osh=$1
33
34 $osh -x -c 'set -o vi'
35 $osh -x -c 'set -o emacs'
36
37 # GLOB_PERIOD
38 $osh -x -c 'shopt -s dotglob'
39
40 set +o errexit
41 # HAVE_PWENT
42 $osh -x -c 'compgen -A user'
43
44 # FNM_EXTMATCH in glob()
45 # Hm this will works
46 $osh -x -c 'echo */*/t@(*.asdl|*.sh)'
47 echo status=$?
48
49 # FNM_EXTMATCH in fnmatch()
50 $osh -x -c 'case foo.py in @(*.asdl|*.py)) echo py ;; esac'
51 echo status=$?
52
53 # --without-readline should not affect Unicode matching!
54 # Fixed 2025-08 with InitLocale()
55 # TODO: make this a hard assertion, and run it in CI. It would be nice to
56 # have some kind of Ninja variants, so we don't have to keep rebuilding Oils.
57
58 $osh <<'EOF'
59var pat = / '_' <capture dot> '_' /
60
61= b'_a_'.leftMatch(pat)
62= b'_\yce\ybc_'.leftMatch(pat)
63EOF
64}
65
66cpp() {
67 #prepare
68
69 test-osh _bin/cxx-asan/osh
70}
71
72py() {
73 #prepare-py
74
75 ln -s -f -v oil.ovm _bin/osh
76
77 #test-osh bin/osh
78
79 test-osh _bin/osh
80}
81
82"$@"