#2 Force CI test
Closed a month ago by bruno. Opened a month ago by bruno.

file added
+20

@@ -0,0 +1,20 @@ 

+ --- squashfs-tools/mksquashfs.c.orig	2019-05-21 01:50:02.197183719 -0500

+ +++ squashfs-tools/mksquashfs.c	2019-05-21 01:51:05.818179903 -0500

+ @@ -50,6 +50,7 @@

+  #include <sys/wait.h>

+  #include <limits.h>

+  #include <ctype.h>

+ +#include <sys/sysmacros.h>

+  

+  #ifndef linux

+  #define __BYTE_ORDER BYTE_ORDER

+ --- squashfs-tools/unsquashfs.c.orig	2019-05-21 01:57:45.984155904 -0500

+ +++ squashfs-tools/unsquashfs.c	2019-05-21 01:58:39.837152674 -0500

+ @@ -37,6 +37,7 @@

+  #include <sys/resource.h>

+  #include <limits.h>

+  #include <ctype.h>

+ +#include <sys/sysmacros.h>

+  

+  struct cache *fragment_cache, *data_cache;

+  struct queue *to_reader, *to_inflate, *to_writer, *from_writer;

file modified
+21 -7

@@ -1,9 +1,8 @@ 

  Summary: Utility for the creation of squashfs filesystems

  Name: squashfs-tools

  Version: 4.3

- Release: 15%{?dist}

+ Release: 20%{?dist}

  License: GPLv2+

- Group: System Environment/Base

  URL: http://squashfs.sourceforge.net/

  Source0: http://downloads.sourceforge.net/squashfs/squashfs%{version}.tar.gz

  # manpages from http://ftp.debian.org/debian/pool/main/s/squashfs-tools/squashfs-tools_4.2+20121212-1.debian.tar.xz

@@ -25,7 +24,9 @@ 

  Patch3:  cve-2015-4645.patch

  # Update formats to match changes in cve-2015-4645.patch

  Patch4:  local-cve-fix.patch

- BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

+ # sys/sysmacros.h is no longer included by sys/types.h

+ Patch5:  glibc.patch

+ BuildRequires:  gcc

  BuildRequires: zlib-devel

  BuildRequires: xz-devel

  BuildRequires: lzo-devel

@@ -43,8 +44,10 @@ 

  %patch2 -p0

  %patch3 -p1

  %patch4 -p0

+ %patch5 -p0

  

  %build

+ %set_build_flags

  pushd squashfs-tools

  CFLAGS="%{optflags}" XZ_SUPPORT=1 LZO_SUPPORT=1 LZMA_XZ_SUPPORT=1 LZ4_SUPPORT=1 make %{?_smp_mflags}

  

@@ -55,11 +58,7 @@ 

  install -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man1/mksquashfs.1

  install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1

  

- %clean

- rm -rf %{buildroot}

- 

  %files

- %defattr(-,root,root,-)

  %doc README ACKNOWLEDGEMENTS DONATIONS PERFORMANCE.README README-4.3 CHANGES pseudo-file.example COPYING

  

  %doc README

@@ -69,6 +68,21 @@ 

  %{_sbindir}/unsquashfs

  

  %changelog

+ * Tue May 21 2019 Bruno Wolff III <bruno@wolff.to> - 4.3-20

+ - Fix issue with LDFLAGS not being set

+ 

+ * Tue May 21 2019 Bruno Wolff III <bruno@wolff.to> - 4.3-19

+ - Fix issue with glibc changes

+ 

+ * Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-18

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

+ 

+ * Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-17

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

+ 

+ * Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-16

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

+ 

  * Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-15

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

  

@@ -0,0 +1,123 @@ 

+ #!/bin/bash

+ 

+ # We need rpmdev-vercmp

+ dnf install -y rpmdevtools

+ rpm -q rpmdevtools > /dev/null 2>&1 || (echo 'rpmdev-vercmp from rpmdevtools is needed to run this script, aborting (failed).'; exit 1)

+ 

+ # Define block sizes

+ blocks=(4K 1M)

+ 

+ # Define fill files

+ fill=(/dev/zero /dev/urandom)

+ 

+ # Define number of iterations

+ iter=5

+ 

+ # Define fragment sizes

+ frags=(0 1 2047 4095)

+ 

+ # Define test directory

+ testdir=/tmp/test-squashfs

+ 

+ # Define mount point

+ mp=${testdir}/mnt

+ 

+ # Define data directory

+ datadir=${testdir}/data

+ 

+ # Check for squashfs-tools version and set compression types to test

+ sqfsver=`rpm -q --qf '%{EVR}' squashfs-tools`

+ if rpmdev-vercmp 4.1 ${sqfsver} > /dev/null; [ $? == '11' ]; then

+   ucomp=('gzip')

+ elif rpmdev-vercmp 4.2 ${sqfsver} > /dev/null; [ $? == '11' ]; then

+   ucomp=(gzip lzo lzma)

+ elif rpmdev-vercmp 4.3-1 ${sqfsver} > /dev/null; [ $? == '11' ]; then

+   ucomp=(gzip lzo lzma xz)

+ elif rpmdev-vercmp 4.3-21 ${sqfsver} > /dev/null; [ $? == '11' ]; then

+   ucomp=(gzip lzo lzma xz lz4)

+ else

+   ucomp=(gzip lzo lzma xz lz4 zstd)

+ fi

+ 

+ # Check for kernel verion and set mount test compression types

+ kernel=`uname -r`

+ if rpmdev-vercmp 2.6.36 ${kernel} > /dev/null; [ $? == '11' ]; then

+   mcomp=('gzip')

+ elif rpmdev-vercmp 2.6.38 ${kernel} > /dev/null; [ $? == '11' ]; then

+   mcomp=(gzip lzo)

+ elif rpmdev-vercmp 3.19 ${kernel} > /dev/null; [ $? == '11' ]; then

+   mcomp=(gzip lzo xz)

+ elif rpmdev-vercmp 4.14 ${kernel} > /dev/null; [ $? == '11' ]; then

+   mcomp=(gzip lzo xz lz4)

+ else

+   mcomp=(gzip lzo xz lz4 zstd)

+ fi

+ 

+ # Check for uid 0 and print a warning if not

+ [ ${UID} -ne 0 ] && echo 'Mount tests will not be performed when not running as root'

+ 

+ # Check if test directory exists and make if not

+ [ -d ${testdir} ] || mkdir ${testdir}

+ [ -d ${testdir} ] || (echo "Unable to make '${testdir}', aborting (failed)."; exit 1)

+ 

+ # Check if mount point directory exists and make if not

+ [ -d ${mp} ] || mkdir ${mp}

+ [ -d ${mp} ] || (echo "Unable to make '${mp}', aborting (failed)."; exit 1)

+ 

+ # Check if data directory exists and make if not

+ if [ -d ${datadir} ]; then

+   echo "Using existing data directory."

+ else

+   echo "Building data directory."

+   mkdir ${datadir}

+   [ -d ${datadir} ] || (echo "Unable to make '${datadir}', aborting (failed)."; exit 1)

+   for size in ${frags[*]}; do

+     for file in ${fill[*]}; do

+       dd if=${file} of=${datadir}/frag-`basename ${file}`-${size} bs=1 count=${size} > /dev/null 2>&1

+     done

+   done

+   for size in ${blocks[*]}; do

+     for ((count=1;${count}<=${iter};count++)); do

+       for file in ${fill[*]}; do

+         dd if=${file} of=${datadir}/file-`basename ${file}`-${size}-${count} bs=${size} count=${count} > /dev/null 2>&1

+       done

+     done

+   done

+   for size1 in ${frags[*]}; do

+     for file1 in ${fill[*]}; do

+       for size2 in ${blocks[*]}; do

+         for ((count=1;${count}<=${iter};count++)); do

+           for file2 in ${fill[*]}; do

+             cat ${datadir}/file-`basename ${file2}`-${size2}-${count} ${datadir}/frag-`basename ${file1}`-${size1} > ${datadir}/combined-`basename ${file2}`-${size2}-${count}-`basename ${file1}`-${size1}

+           done

+         done

+       done

+     done

+   done

+ fi

+ 

+ # Run unmounted tests

+ for comp in ${ucomp[*]}; do

+   echo "Building squashfs image using ${comp} compression."

+   if [ "${comp}" == gzip ]; then

+     mksquashfs ${datadir} ${testdir}/sq.img || (echo "mksquashfs failed for ${comp} compression."; continue)

+   else

+     mksquashfs ${datadir} ${testdir}/sq.img -comp ${comp} || (echo "mksquashfs failed for ${comp} compression."; continue)

+   fi

+   echo "Testing unmounted extract using ${comp} compression."

+   unsquashfs -d ${testdir}/sq ${testdir}/sq.img  || echo "unsquashfs failed for ${comp} compression."

+   diff -r -q ${testdir}/sq ${datadir} || (echo "Extract test failed for ${comp} compression."; exit)

+   rm -rf ${testdir}/sq

+   if [ ${UID} == 0 ]; then

+     for kern in ${mcomp[*]}; do

+       if [ ${kern} == ${comp} ]; then

+         echo "Testing mounted image using ${comp} compression."

+         mount -r -o loop ${testdir}/sq.img ${mp} || echo "Mount failed.";

+         diff -r -q ${mp} ${datadir} || echo "Mounted test failed for ${comp} compression."

+         umount ${mp}

+         break

+       fi

+     done

+   fi

+   rm -f ${testdir}/sq ${testdir}/sq.img

+ done

@@ -0,0 +1,27 @@ 

+ ---

+ - hosts: localhost

+   vars:

+   - artifacts: ./artifacts

+   tags:

+   - classic

+   remote_user: root

+   tasks:

+   - name: Install the test files

+     copy: src={{ item.file }} dest=/usr/local/bin/{{ item.dest }} mode=0755

+     with_items:

+     - {file: Squashfs-compression-test.sh, dest: Squashfs-compression-test.sh }

+   - name: Test block

+     block:

+       - name: Execute the tests

+         shell: |

+           /usr/local/bin/Squashfs-compression-test.sh &> /tmp/test.log; grep -iq failed /tmp/test.log && result=fail || result=pass

+           echo -e "results:\n- {result: $result, test: working}" > /tmp/results.yml

+     always:

+       - name: Pull out the logs

+         fetch:

+           dest: "{{ artifacts }}/"

+           src: "{{ item }}"

+           flat: yes

+         with_items:

+           - /tmp/test.log

+           - /tmp/results.yml

file added
+1

@@ -0,0 +1,1 @@ 

+ - import_playbook: test_working.yml