On 1/13/23 19:57, Pali Rohár wrote:
On Friday 13 January 2023 19:25:01 Heinrich Schuchardt wrote:
Downloading files for a test may fail if the server is offline.
It is preferable to provide the files in our Docker image.

Signed-off-by: Heinrich Schuchardt <[email protected]>
---
  tools/docker/Dockerfile | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index 202a8145af..ee44668ae0 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -213,6 +213,15 @@ RUN git clone https://github.com/stefanberger/swtpm /tmp/swtpm 
&& \
        make install && \
        rm -rf /tmp/swtpm
+# Files to run Nokia RX-51 (aka N900) tests
+RUN mkdir -p /opt/nokia && \
+       cd /opt/nokia && \
+       wget 
https://raw.githubusercontent.com/pali/u-boot-maemo/master/debian/u-boot-gen-combined 
&& \
+       wget http://repository.maemo.org/qemu-n900/qemu-n900.tar.gz && \
+       wget 
http://repository.maemo.org/pool/maemo5.0/free/k/kernel/kernel_2.6.28-20103103+0m5_armel.deb
 && \
+       wget 
http://repository.maemo.org/pool/maemo5.0/free/g/glibc/libc6_2.5.1-1eglibc27+0m5_armel.deb
 && \
+       wget 
http://repository.maemo.org/pool/maemo5.0/free/b/busybox/busybox_1.10.2.legal-1osso30+0m5_armel.deb
+
  # Create our user/group
  RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot
  RUN useradd -m -U uboot
--
2.37.2


And for using pre-downloaded binaries in CI, I'm proposing following (UNTESTED) 
patch:

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index ca29479745e6..061523f86ffc 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -204,6 +204,12 @@ stages:
        options: $(container_option)
      steps:
        - script: |
+          mkdir nokia_rx51_tmp
+          ln -s /opt/nokia/u-boot-gen-combined nokia_rx51_tmp/
+          ln -s /opt/nokia/qemu-n900.tar.gz nokia_rx51_tmp/
+          ln -s /opt/nokia/kernel_2.6.28-20103103+0m5_armel.deb nokia_rx51_tmp/
+          ln -s /opt/nokia/libc6_2.5.1-1eglibc27+0m5_armel.deb nokia_rx51_tmp/
+          ln -s /opt/nokia/busybox_1.10.2.legal-1osso30+0m5_armel.deb 
nokia_rx51_tmp/
            export PATH=/opt/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin:$PATH
            test/nokia_rx51_test.sh
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 91d5e0c4a8c8..07d0a3da344d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -225,8 +225,14 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites:
  Run tests for Nokia RX-51 (aka N900):
    stage: testsuites
    script:
-    - export PATH=/opt/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin:$PATH;
-      test/nokia_rx51_test.sh
+    - mkdir nokia_rx51_tmp
+    - ln -s /opt/nokia/u-boot-gen-combined nokia_rx51_tmp/
+    - ln -s /opt/nokia/qemu-n900.tar.gz nokia_rx51_tmp/
+    - ln -s /opt/nokia/kernel_2.6.28-20103103+0m5_armel.deb nokia_rx51_tmp/
+    - ln -s /opt/nokia/libc6_2.5.1-1eglibc27+0m5_armel.deb nokia_rx51_tmp/
+    - ln -s /opt/nokia/busybox_1.10.2.legal-1osso30+0m5_armel.deb 
nokia_rx51_tmp/
+    - export PATH=/opt/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin:$PATH
+    - test/nokia_rx51_test.sh
# Check for any pylint regressions
  Run pylint:
diff --git a/test/nokia_rx51_test.sh b/test/nokia_rx51_test.sh
index a516ec2967c3..dca9ef3027b7 100755
--- a/test/nokia_rx51_test.sh
+++ b/test/nokia_rx51_test.sh
@@ -83,8 +83,10 @@ echo
# Download qflasher and nolo images
  # This is proprietary qemu flasher tool with first stage images, but license 
allows non-commercial redistribution
-wget -c http://repository.maemo.org/qemu-n900/qemu-n900.tar.gz
-tar -xf qemu-n900.tar.gz
+if ! test -f qflasher || ! test -f xloader-qemu.bin || ! test -f 
secondary-qemu.bin; then
+       test -f qemu-n900.tar.gz || wget -c 
http://repository.maemo.org/qemu-n900/qemu-n900.tar.gz
+       tar -xf qemu-n900.tar.gz
+fi
# Download Maemo script u-boot-gen-combined
  if ! test -f u-boot-gen-combined; then
@@ -94,16 +96,22 @@ if ! test -f u-boot-gen-combined; then
  fi
# Download Maemo fiasco kernel
-wget -c 
http://repository.maemo.org/pool/maemo5.0/free/k/kernel/kernel_2.6.28-20103103+0m5_armel.deb
-dpkg -x kernel_2.6.28-20103103+0m5_armel.deb kernel_2.6.28
+if ! test -d kernel_2.6.28; then
+       test -f kernel_2.6.28-20103103+0m5_armel.deb || wget -c 
http://repository.maemo.org/pool/maemo5.0/free/k/kernel/kernel_2.6.28-20103103+0m5_armel.deb
+       dpkg -x kernel_2.6.28-20103103+0m5_armel.deb kernel_2.6.28
+fi
# Download Maemo libc
-wget -c 
http://repository.maemo.org/pool/maemo5.0/free/g/glibc/libc6_2.5.1-1eglibc27+0m5_armel.deb
-dpkg -x libc6_2.5.1-1eglibc27+0m5_armel.deb libc6_2.5.1
+if ! test -d libc6_2.5.1; then
+       test -f libc6_2.5.1-1eglibc27+0m5_armel.deb || wget -c 
http://repository.maemo.org/pool/maemo5.0/free/g/glibc/libc6_2.5.1-1eglibc27+0m5_armel.deb
+       dpkg -x libc6_2.5.1-1eglibc27+0m5_armel.deb libc6_2.5.1
+fi
# Download Maemo busybox
-wget -c 
http://repository.maemo.org/pool/maemo5.0/free/b/busybox/busybox_1.10.2.legal-1osso30+0m5_armel.deb
-dpkg -x busybox_1.10.2.legal-1osso30+0m5_armel.deb busybox_1.10.2
+if ! test -d busybox_1.10.2; then
+       test -f busybox_1.10.2.legal-1osso30+0m5_armel.deb || wget -c 
http://repository.maemo.org/pool/maemo5.0/free/b/busybox/busybox_1.10.2.legal-1osso30+0m5_armel.deb
+       dpkg -x busybox_1.10.2.legal-1osso30+0m5_armel.deb busybox_1.10.2
+fi
echo
  echo "======================================="


The test script will still be needed for testing outside Docker.
We should create a separate script for Docker usage instead.

Best regards

Heinrich

Reply via email to