Skip to content
This repository was archived by the owner on Feb 28, 2023. It is now read-only.

Commit c432caf

Browse files
committed
tests: remove Python 2; update for embedded Python 3
1 parent faedbb1 commit c432caf

File tree

6 files changed

+17
-156
lines changed

6 files changed

+17
-156
lines changed

tests/scripts/README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ bash ~/Downloads/riscv-none-embed-gcc-xpack.git/tests/scripts/native-test.sh \
8585
```
8686

8787
Aditional options are `--32` (which must be given first) and
88-
`--skip-gdb-py`, `--skip-gdb-py3` which can be added at the end.
88+
`--skip-gdb-py3` which can be added at the end.
8989

9090
## Rerun test
9191

@@ -118,15 +118,6 @@ tested.
118118
The GDB client is started with various options and commands, and should
119119
exit 0.
120120

121-
Testing the GDB binaries which include Python support proved quite
122-
difficult, and is done summarily, only when possible.
123-
124-
The problem is that embedding Python requires the presence of exactly
125-
the same version; if for final machines building from sources this exact
126-
version is relatively easy, doing this on all dcocker images is to
127-
expensive, so if the exact versions are found, the gdb-py tests are
128-
performed, otherwise are skipped.
129-
130121
## GitHub API endpoint
131122

132123
Programatic access to GitHub is done via the v3 API:

tests/scripts/common-functions-source.sh

Lines changed: 13 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -133,95 +133,6 @@ function test_gdb()
133133
fi
134134

135135
(
136-
case "${suffix}" in
137-
'')
138-
;;
139-
140-
-py)
141-
local python_name
142-
if [ "${node_platform}" == "win32" ]
143-
then
144-
python_name="python"
145-
else
146-
python_name="python2.7"
147-
fi
148-
149-
echo
150-
echo "Identifying Python 2..."
151-
152-
local which_python
153-
set +e
154-
which_python="$(which ${python_name} 2>/dev/null)"
155-
if [ -z "${which_python}" ]
156-
then
157-
echo
158-
echo ">>> No ${python_name} installed, skipping gdb_py test."
159-
return
160-
fi
161-
set -e
162-
163-
echo "Found as ${which_python}."
164-
165-
echo
166-
${python_name} --version
167-
168-
export PYTHONHOME="$(${python_name} -c 'import sys; print(sys.prefix)')"
169-
export PYTHONPATH="$(${python_name} -c 'import sys; import os; print(os.pathsep.join(sys.path))')"
170-
echo "PYTHONHOME=${PYTHONHOME}"
171-
echo "PYTHONPATH=${PYTHONPATH}"
172-
;;
173-
174-
-py3)
175-
local python_name
176-
if [ "${node_platform}" == "win32" ]
177-
then
178-
if [ -f "/c/Python38/python.exe" ]
179-
then
180-
export PATH="/c/Python38:$PATH"
181-
elif [ -f "/c/Python37/python.exe" ]
182-
then
183-
export PATH="/c/Python37:$PATH"
184-
fi
185-
186-
python_name="python"
187-
elif [ "${node_platform}" == "linux" ]
188-
then
189-
python_name="python3.7"
190-
elif [ "${node_platform}" == "darwin" ]
191-
then
192-
python_name="python3.7"
193-
fi
194-
195-
echo
196-
echo "Identifying Python 3..."
197-
198-
set +e
199-
local which_python
200-
which_python="$(which ${python_name} 2>/dev/null)"
201-
if [ -z "${which_python}" ]
202-
then
203-
echo
204-
echo ">>> No ${python_name} installed, skipping gdb_py3 test."
205-
return
206-
fi
207-
set -e
208-
echo "Found as ${which_python}."
209-
210-
echo
211-
${python_name} --version
212-
213-
export PYTHONHOME="$(${python_name} -c 'import sys; print(sys.prefix)')"
214-
export PYTHONPATH="$(${python_name} -c 'import sys; import os; print(os.pathsep.join(sys.path))')"
215-
echo "PYTHONHOME=${PYTHONHOME}"
216-
echo "PYTHONPATH=${PYTHONPATH}"
217-
;;
218-
219-
*)
220-
echo "Unsupported gdb-${suffix}"
221-
exit 1
222-
;;
223-
esac
224-
225136
echo
226137
echo "Testing if gdb${suffix} starts properly..."
227138

@@ -240,11 +151,24 @@ function test_gdb()
240151
-ex='set language auto' \
241152
-ex='quit'
242153

154+
if [ "${suffix}" == "-py3" ]
155+
then
156+
# Show Python paths.
157+
run_app "${app_folder_path}/bin/${gcc_target_prefix}-gdb${suffix}" \
158+
--nh \
159+
--nx \
160+
-ex='set pagination off' \
161+
-ex='python import sys; print(sys.prefix)' \
162+
-ex='python import sys; import os; print(os.pathsep.join(sys.path))' \
163+
-ex='quit'
164+
fi
165+
243166
if [ ! -z "${suffix}" ]
244167
then
245168
local out=$("${app_folder_path}/bin/${gcc_target_prefix}-gdb${suffix}" \
246169
--nh \
247170
--nx \
171+
-ex='set pagination off' \
248172
-ex='python print("babu"+"riba")' \
249173
-ex='quit' | grep 'baburiba')
250174
if [ "${out}" == "baburiba" ]
@@ -291,20 +215,6 @@ function run_tests()
291215
run_app ldd -v "${file_path}" || true
292216
done
293217
fi
294-
295-
echo
296-
echo "All tests completed successfully."
297-
298-
echo
299-
run_app uname -a
300-
if [ "${node_platform}" == "linux" ]
301-
then
302-
run_app lsb_release -a
303-
run_app ldd --version
304-
elif [ "${node_platform}" == "darwin" ]
305-
then
306-
run_app sw_vers
307-
fi
308218
}
309219

310220
# -----------------------------------------------------------------------------

tests/scripts/container-test.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ base_url="$1"
6161
echo "${base_url}"
6262
shift
6363

64-
has_gdb_py="y"
6564
has_gdb_py3="y"
6665

6766
while [ $# -gt 0 ]
@@ -83,18 +82,14 @@ if [[ ${image_name} == *ubuntu* ]] || [[ ${image_name} == *debian* ]] || [[ ${im
8382
then
8483
run_verbose apt-get -qq update
8584
run_verbose apt-get -qq install -y git-core curl tar gzip lsb-release binutils
86-
# run_verbose apt-get -qq install -y python || true
87-
# run_verbose apt-get -qq install -y python3 || true
8885
elif [[ ${image_name} == *centos* ]] || [[ ${image_name} == *fedora* ]]
8986
then
9087
run_verbose yum install -y -q git curl tar gzip redhat-lsb-core binutils
91-
# run_verbose yum install -y -q python || true
92-
# run_verbose yum install -y -q python3 || true
9388
elif [[ ${image_name} == *opensuse* ]]
9489
then
90+
run_verbose zypper -q refresh
91+
run_verbose zypper -q update -y
9592
run_verbose zypper -q in -y git-core curl tar gzip lsb-release binutils
96-
# run_verbose zypper -q in -y python || true
97-
run_verbose zypper -q in -y python3 || true
9893
elif [[ ${image_name} == *manjaro* ]]
9994
then
10095
run_verbose pacman-mirrors -g
@@ -103,17 +98,13 @@ then
10398
# Update even if up to date (-yy) & upgrade (-u).
10499
# pacman -S -yy -u -q --noconfirm
105100
run_verbose pacman -S -q --noconfirm --noprogressbar git curl tar gzip lsb-release binutils file
106-
# run_verbose pacman -S -q --noconfirm --noprogressbar python || true
107-
# run_verbose pacman -S -q --noconfirm --noprogressbar python3 || true
108101
elif [[ ${image_name} == *archlinux* ]]
109102
then
110103
pacman -S -y -q --noconfirm
111104

112105
# Update even if up to date (-yy) & upgrade (-u).
113106
# pacman -S -yy -u -q --noconfirm
114107
run_verbose pacman -S -q --noconfirm --noprogressbar git curl tar gzip lsb-release binutils file
115-
# run_verbose pacman -S -q --noconfirm --noprogressbar python || true
116-
# run_verbose pacman -S -q --noconfirm --noprogressbar python3 || true
117108
fi
118109

119110
# -----------------------------------------------------------------------------

tests/scripts/container-xpm-install-test.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,12 @@ then
7777
run_verbose apt-get -qq update
7878
run_verbose apt-get -qq install -y git-core curl tar gzip lsb-release binutils
7979
run_verbose apt-get -qq install -y build-essential
80-
run_verbose apt-get -qq install -y python || true
81-
# run_verbose apt-get -qq install -y python3 || true
8280
elif [[ ${image_name} == *centos* ]] || [[ ${image_name} == *fedora* ]]
8381
then
8482
run_verbose yum install -y -q git curl tar gzip redhat-lsb-core binutils
85-
run_verbose yum install -y -q python || true
86-
# run_verbose yum install -y -q python3 || true
8783
elif [[ ${image_name} == *opensuse* ]]
8884
then
8985
run_verbose zypper -q in -y git-core curl tar gzip lsb-release binutils
90-
run_verbose zypper -q in -y python || true
91-
# run_verbose zypper -q in -y python3 || true
9286
elif [[ ${image_name} == *manjaro* ]]
9387
then
9488
run_verbose pacman-mirrors -g
@@ -97,17 +91,13 @@ then
9791
# Update even if up to date (-yy) & upgrade (-u).
9892
# pacman -S -yy -u -q --noconfirm
9993
run_verbose pacman -S -q --noconfirm --noprogressbar git curl tar gzip lsb-release binutils file
100-
run_verbose pacman -S -q --noconfirm --noprogressbar python || true
101-
# run_verbose pacman -S -q --noconfirm --noprogressbar python3 || true
10294
elif [[ ${image_name} == *archlinux* ]]
10395
then
10496
pacman -S -y -q --noconfirm
10597

10698
# Update even if up to date (-yy) & upgrade (-u).
10799
# pacman -S -yy -u -q --noconfirm
108100
run_verbose pacman -S -q --noconfirm --noprogressbar git curl tar gzip lsb-release binutils file
109-
run_verbose pacman -S -q --noconfirm --noprogressbar python || true
110-
# run_verbose pacman -S -q --noconfirm --noprogressbar python3 || true
111101
fi
112102

113103
# -----------------------------------------------------------------------------

tests/scripts/native-test.sh

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,12 @@ base_url="$1"
6262
echo "${base_url}"
6363
shift
6464

65-
has_gdb_py="y"
6665
has_gdb_py3="y"
6766

6867
while [ $# -gt 0 ]
6968
do
7069
case "$1" in
7170

72-
--skip-gdb-py)
73-
has_gdb_py="n"
74-
shift
75-
;;
76-
7771
--skip-gdb-py3)
7872
has_gdb_py3="n"
7973
shift
@@ -93,21 +87,6 @@ echo "${base_url}"
9387

9488
detect_architecture
9589

96-
if [ "${node_platform}" == "win32" ]
97-
then
98-
# https://chocolatey.org/docs/commands-reference
99-
choco list --local-only
100-
# https://chocolatey.org/packages/python3
101-
choco install python --version=3.7.6 --yes
102-
env | sort
103-
104-
echo
105-
echo ls -l /c/Python*
106-
ls -l /c/Python*
107-
108-
echo
109-
fi
110-
11190
prepare_env "$(dirname $(dirname "${script_folder_path}"))"
11291

11392
install_archive

tests/scripts/trigger-travis-quick.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ source "${helper_folder_path}/test-functions-source.sh"
5050

5151
# -----------------------------------------------------------------------------
5252

53-
message="Test ${app_description} on stable platforms"
53+
message="Test ${app_description} on few platforms"
5454
branch="xpack-develop"
5555

5656
version="$(cat $(dirname $(dirname ${script_folder_path}))/scripts/VERSION)"

0 commit comments

Comments
 (0)