diff --git a/.gitignore b/.gitignore index e69de29..0fc702c 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,6 @@ +libunistring-0.9.3.tar.gz +/libunistring-0.9.4.tar.xz +/libunistring-0.9.7.tar.xz +/libunistring-0.9.8.tar.xz +/libunistring-0.9.9.tar.xz +/libunistring-0.9.10.tar.xz diff --git a/README.md b/README.md new file mode 100644 index 0000000..fd5c17f --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# libunistring + +This project conatains libunistring i18n testcases diff --git a/libunistring.spec b/libunistring.spec new file mode 100644 index 0000000..45af817 --- /dev/null +++ b/libunistring.spec @@ -0,0 +1,158 @@ +# This spec file has been automatically updated +Version: 0.9.10 +Release: 9%{?dist} +Name: libunistring +Summary: GNU Unicode string library +License: GPLV2+ or LGPLv3+ +Url: http://www.gnu.org/software/libunistring/ +Source0: http://ftp.gnu.org/gnu/libunistring/%{name}-%{version}.tar.xz +BuildRequires: gcc +Provides: bundled(gnulib) + +%description +This portable C library implements Unicode string types in three flavours: +(UTF-8, UTF-16, UTF-32), together with functions for character processing +(names, classifications, properties) and functions for string processing +(iteration, formatted output, width, word breaks, line breaks, normalization, +case folding and regular expressions). + +%package devel +Summary: GNU Unicode string library - development files +Requires: %{name} = %{version}-%{release} + +%description devel +Development files for programs using libunistring. + +%prep +%setup -q + +%build +%configure --disable-static --disable-rpath +%make_build + +%install +%make_install +rm -f $RPM_BUILD_ROOT/%{_infodir}/dir +rm -f $RPM_BUILD_ROOT/%{_libdir}/%{name}.la +# Move staged docs so not picked up by %%doc in main package +mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name} __doc + +%files +%license COPYING COPYING.LIB +%doc AUTHORS NEWS README +%{_libdir}/%{name}.so.* + +%files devel +%doc HACKING DEPENDENCIES THANKS ChangeLog +%doc __doc/* +%{_infodir}/%{name}.info* +%{_libdir}/%{name}.so +%{_includedir}/unistring +%{_includedir}/*.h + +%ldconfig_scriptlets + +%changelog +* Tue Jul 28 2020 Fedora Release Engineering - 0.9.10-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 13 2020 Tom Stellard - 0.9.10-8 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + +* Wed Jan 29 2020 Fedora Release Engineering - 0.9.10-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Jul 25 2019 Fedora Release Engineering - 0.9.10-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering - 0.9.10-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Jul 31 2018 Florian Weimer - 0.9.10-4 +- Rebuild with fixed binutils + +* Sat Jul 28 2018 Igor Gnatenko - 0.9.10-3 +- Replace obsolete scriptlets + +* Fri Jul 13 2018 Fedora Release Engineering - 0.9.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon May 28 2018 Daiki Ueno - 0.9.10-1 +- Update to upstream 0.9.10 release + +* Thu Mar 01 2018 Daiki Ueno - 0.9.9-1 +- Update to upstream 0.9.9 release + +* Wed Feb 07 2018 Fedora Release Engineering - 0.9.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Feb 03 2018 Igor Gnatenko - 0.9.8-2 +- Switch to %%ldconfig_scriptlets + +* Sat Dec 2 2017 Daiki Ueno - 0.9.8-1 +- Update to 0.9.8 + +* Thu Aug 03 2017 Fedora Release Engineering - 0.9.7-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 0.9.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 17 2017 Daiki Ueno - 0.9.7-1 +- Update to 0.9.7 +- Update license to "GPLv2+ or LGPLv2+" + +* Wed Feb 01 2017 Stephen Gallagher - 0.9.4-4 +- Add missing %%license macro + +* Thu Feb 04 2016 Fedora Release Engineering - 0.9.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 0.9.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Tue Sep 02 2014 Pádraig Brady - 0.9.4-1 +- Latest upstream + +* Sun Aug 17 2014 Fedora Release Engineering - 0.9.3-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 0.9.3-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu Aug 29 2013 Pádraig Brady 0.9.3-9 +- Adjust to avoid duplicate docs caused by %%doc macro changes in Fedora 20 + +* Sat Aug 03 2013 Fedora Release Engineering - 0.9.3-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 0.9.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 0.9.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Jun 26 2012 Akira TAGOH - 0.9.3-5 +- Fix a typo in %%preun. (#737638) + +* Tue May 15 2012 Mikolaj Izdebski - 0.9.3-4 +- Add bundled(gnulib) provides + +* Fri Jan 13 2012 Fedora Release Engineering - 0.9.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Feb 08 2011 Fedora Release Engineering - 0.9.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sun May 23 2010 Pádraig Brady 0.9.3-1 +- Update to 0.9.3 + +* Thu Nov 19 2009 Pádraig Brady 0.9.1-3 +- Remove glibc-devel and texinfo build deps + +* Thu Nov 19 2009 Pádraig Brady 0.9.1-2 +- Changes as per initial review by panemade@gmail.com + +* Tue Nov 17 2009 Pádraig Brady 0.9.1-1 +- Initial version diff --git a/sources b/sources new file mode 100644 index 0000000..fdd5713 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (libunistring-0.9.10.tar.xz) = 01dcab6e05ea4c33572bf96cc0558bcffbfc0e62fc86410cef06c1597a0073d5750525fe2dee4fdb39c9bd704557fcbab864f9645958108a2e07950bc539fe54 diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..fd5c17f --- /dev/null +++ b/tests/README.md @@ -0,0 +1,3 @@ +# libunistring + +This project conatains libunistring i18n testcases diff --git a/tests/libunistring-tests/Makefile b/tests/libunistring-tests/Makefile new file mode 100644 index 0000000..7cfe531 --- /dev/null +++ b/tests/libunistring-tests/Makefile @@ -0,0 +1,61 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/python/libunistring-tests +# Description: Functional tests for libunistring. +# Author: Pooja Yadav +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +export TEST=/CoreOS/python/libunistring-tests +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) libunistring_test.py Makefile test runtest.sh + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + +$(METADATA): Makefile + @echo "Owner: Pooja Yadav " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Functional test for the gettext module" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: python" >> $(METADATA) + @echo "Requires: python" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) + diff --git a/tests/libunistring-tests/libunistring_test.py b/tests/libunistring-tests/libunistring_test.py new file mode 100644 index 0000000..a9c688e --- /dev/null +++ b/tests/libunistring-tests/libunistring_test.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- + +import os +import subprocess +import logging + +""" +Creating a result.log file for saving logs +""" +logging.basicConfig(level=logging.INFO) + +logging.info("TEST RESULTS FOR FUNCTION\n\n") + +data = [] + +def create_testfile(): + testfile = subprocess.call("./test 'Bonjour le monde'" , shell=True) + with open("./testfile.in") as fh: + lines = fh.readlines() + global data + data = lines + +def test_utf8(): + """ + Check UTF-8 encoding + """ + try: + conv8 = data[0].strip("\n").decode('utf-8') + conv16 = data[0].strip("\n").decode('utf-16') + if conv8 == ("Bonjour le monde") and conv16 != ("Bonjour le monde"): + logging.info("UTF-8 Conversion Test: SUCCESS") + else: + logging.error("UTF-8 Conversion Test: ERROR") + except UnicodeError: + logging.error("UTF-8 Conversion Test: UnicodeError") + +def test_utf_16(): + """ + Check UTF-16 encoding + """ + try: + conv16 = data[1].strip("\n").decode('utf-16') + conv8 = data[1].strip("\n").decode('utf-8') + if conv16 == ("Bonjour le monde") and conv8 != ("Bonjour le monde"): + logging.info("UTF-16 Conversion Test: SUCCESS") + else: + logging.error("UTF-16 Conversion Test: ERROR") + except UnicodeError: + logging.error("UTF-16 Conversion Test: UnicodeError") + +def test_utf_32(): + """ + Check UTF-32 encoding + """ + try: + conv8 = data[2].strip("\n").decode('utf-8') + conv16= data[2].strip("\n").decode('utf-16') + conv32 = data[2].strip("\n").decode('utf-32') + if conv32 == ("Bonjour le monde") and conv8 and conv16 != ("Bonjour le monde"): + logging.info("UTF-32 Conversion Test: SUCCESS") + else: + logging.error("UTF-32 Conversion Test: ERROR") + except UnicodeError: + logging.error("UTF-32 Conversion Test: UnicodeError") + +def del_testfile(): + try: + subprocess.call(['rm', '-rf', './testfile.in']) + except OSError as e: + logging.error("OSError\n") + + +if __name__ == "__main__": + del_testfile() + create_testfile() + test_utf8() + test_utf_16() + test_utf_32() + diff --git a/tests/libunistring-tests/runtest.sh b/tests/libunistring-tests/runtest.sh new file mode 100644 index 0000000..64e85ac --- /dev/null +++ b/tests/libunistring-tests/runtest.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/python/libunistring-tests +# Description: Functional tests for libunistring to check i18n features. +# Author: Pooja Yadav +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh +. /usr/lib/beakerlib/beakerlib.sh + +PACKAGE="libunistring" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory" + rlRun "cp libunistring_test.py test $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlLog "Run libunistring_test.py" + rlRun "python libunistring_test.py" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd + diff --git a/tests/libunistring-tests/test.c b/tests/libunistring-tests/test.c new file mode 100644 index 0000000..5111d51 --- /dev/null +++ b/tests/libunistring-tests/test.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include +#include +#include + +int +main (int argc, char **argv) +{ + if (argc < 2) { + printf ("Usage: %s \n", argv[0]); + return 1; + } + + size_t len8, len16, len32; + const char newline = '\n'; + + uint8_t *res8 = u8_conv_from_encoding ("ASCII", iconveh_question_mark, argv[1], strlen (argv[1]), NULL, NULL, &len8); + uint16_t *res16 = u16_conv_from_encoding ("ASCII", iconveh_question_mark, argv[1], strlen (argv[1]), NULL, NULL, &len16); + uint32_t *res32 = u32_conv_from_encoding ("ASCII", iconveh_question_mark, argv[1], strlen (argv[1]), NULL, NULL, &len32); + + int fd = open ("testfile.in", O_WRONLY | O_CREAT, S_IRUSR); + + for (int i = 0; i < len8; i++) + write (fd, &res8[i], sizeof (uint8_t)); + write (fd, &newline, 1); + for (int i = 0; i < len16; i++) + write (fd, &res16[i], sizeof (uint16_t)); + write (fd, &newline, 1); + for (int i = 0; i < len32; i++) + write (fd, &res32[i], sizeof (uint32_t)); + + close (fd); +} + diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..1b4c3ec --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,23 @@ +--- + +# Tests for Atomic +- hosts: localhost + tags: + - atomic + roles: + - role: standard-test-beakerlib + tests: + - libunistring-tests + +# Tests for Classic and Container +- hosts: localhost + tags: + - classic + - container + roles: + - role: standard-test-beakerlib + tests: + - libunistring-tests + required_packages: + - libunistring + - libunistring-devel