Mercurial > nand-ecoscentric
changeset 3278:f5d2adaa8595
* src/fstream.cpp: Fix processing of fstream openmode. Patch from
uSTL HEAD.
* cdl/ustl.cdl: Build interactive tests under control of a CDL
option. Build ROM filesystem for bvt25 test under control of a
CDL option.
* tests/bvt25.cpp: Use ROM filesystem if available.
* tests/bvt05.cpp, tests/bvt16.cpp: Reduce data structure sizes
for embedded use.
| author | jld |
|---|---|
| date | Thu, 21 Feb 2013 08:34:10 +0000 |
| parents | 5e8c9e64b5b0 |
| children | b1adab1ffd9b |
| files | packages/language/cxx/ustl/current/ChangeLog packages/language/cxx/ustl/current/cdl/ustl.cdl packages/language/cxx/ustl/current/src/fstream.cpp packages/language/cxx/ustl/current/tests/bvt05.cpp packages/language/cxx/ustl/current/tests/bvt16.cpp packages/language/cxx/ustl/current/tests/bvt25.cpp |
| diffstat | 6 files changed, 102 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/language/cxx/ustl/current/ChangeLog +++ b/packages/language/cxx/ustl/current/ChangeLog @@ -1,3 +1,14 @@ +2013-02-18 John Dallaway <john@dallaway.org.uk> + + * src/fstream.cpp: Fix processing of fstream openmode. Patch + from uSTL HEAD. + * cdl/ustl.cdl: Build interactive tests under control of a CDL + option. Build ROM filesystem for bvt25 test under control of a + CDL option. + * tests/bvt25.cpp: Use ROM filesystem if available. + * tests/bvt05.cpp, tests/bvt16.cpp: Reduce data structure sizes + for embedded use. + 2012-03-24 Sergei Gavrikov <sergei.gavrikov@gmail.com> * include/*: @@ -56,7 +67,7 @@ 2009-08-20 Uwe Kindler <uwe_kindler@web // ####GPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010, 2011, 2013 Free Software Foundation, 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
--- a/packages/language/cxx/ustl/current/cdl/ustl.cdl +++ b/packages/language/cxx/ustl/current/cdl/ustl.cdl @@ -8,7 +8,7 @@ ## ####ECOSGPLCOPYRIGHTBEGIN#### ## ------------------------------------------- ## This file is part of eCos, the Embedded Configurable Operating System. -## Copyright (C) 2009 Free Software Foundation, Inc. +## Copyright (C) 2009, 2013 Free Software Foundation, Inc. ## ## eCos 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 @@ -40,7 +40,7 @@ ######DESCRIPTIONBEGIN#### # # Author(s): Uwe Kindler -# Contributors: +# Contributors: jld # Date: 2009-07-28 # #####DESCRIPTIONEND#### @@ -183,11 +183,62 @@ cdl_package CYGPKG_USTL { the set of global flags if present." } + cdl_option CYGIMP_USTL_TESTS_BVT25_ROMFS { + display "Build ROM filesystem for bvt25 test" + flavor bool + active_if CYGVAR_USTL_CIN_COUT_CERR + requires CYGPKG_FS_ROM + requires CYGBLD_FS_ROMFS_MK_ROMFS + default_value CYGBLD_FS_ROMFS_MK_ROMFS + description " + Enable this option to build a ROM filesystem for use + by the bvt25 test. If you disable this option, you will + need to provide an alternative filesystem containing + the file \"bvt25.std\"." + make { + <PREFIX>/include/cyg/ustl/bvt25fs_be.h : <PACKAGE>/tests/bvt25.std + @mkdir -p bvt25_be + @cp $< bvt25_be/$(<F) + @chmod u+w bvt25_be/$(<F) + @$(PREFIX)/bin/mk_romfs -b bvt25_be $(@F:.h=.tmp) + @mkdir -p "$(@D)" + tclsh $(PREFIX)/bin/file2c.tcl $(@F:.h=.tmp) $@ + @rm -r bvt25_be $(@F:.h=.tmp) + } + make { + <PREFIX>/include/cyg/ustl/bvt25fs_le.h : <PACKAGE>/tests/bvt25.std + @mkdir -p bvt25_le + @cp $< bvt25_le/$(<F) + @chmod u+w bvt25_le/$(<F) + @$(PREFIX)/bin/mk_romfs bvt25_le $(@F:.h=.tmp) + @mkdir -p "$(@D)" + tclsh $(PREFIX)/bin/file2c.tcl $(@F:.h=.tmp) $@ + @rm -r bvt25_le $(@F:.h=.tmp) + } + } + + cdl_option CYGBLD_USTL_BUILD_INTERACTIVE_TESTS { + display "Build interactive uSTL tests" + flavor bool + no_define + active_if CYGVAR_USTL_CIN_COUT_CERR + default_value 0 + description " + This option enables the building of uSTL tests which + require user input (bvt13, bvt17). The easiest way to + run these tests is to build them for the synthetic + (linux) target and redirect standard input from file + at a shell prompt. For example: ./bvt13 < bvt13.cpp" + } + cdl_option CYGPKG_USTL_TESTS { display "uSTL tests" flavor data no_define - calculated { (CYGVAR_USTL_CIN_COUT_CERR ? "tests/bvt00 tests/bvt01 tests/bvt02 tests/bvt03 tests/bvt04 tests/bvt05 tests/bvt06 tests/bvt07 tests/bvt08 tests/bvt09 tests/bvt10 tests/bvt11 tests/bvt12 tests/bvt13 tests/bvt14 tests/bvt15 tests/bvt16 tests/bvt17 tests/bvt18 tests/bvt19 tests/bvt20 tests/bvt21 tests/bvt22 tests/bvt23 tests/bvt24 tests/bvt25 tests/bvt26 tests/bvt27" : "" )} + calculated { (CYGVAR_USTL_CIN_COUT_CERR ? + (CYGBLD_USTL_BUILD_INTERACTIVE_TESTS ? + "tests/bvt00 tests/bvt01 tests/bvt02 tests/bvt03 tests/bvt04 tests/bvt05 tests/bvt06 tests/bvt07 tests/bvt08 tests/bvt09 tests/bvt10 tests/bvt11 tests/bvt12 tests/bvt13 tests/bvt14 tests/bvt15 tests/bvt16 tests/bvt17 tests/bvt18 tests/bvt19 tests/bvt20 tests/bvt21 tests/bvt22 tests/bvt23 tests/bvt24 tests/bvt25 tests/bvt26 tests/bvt27" : + "tests/bvt00 tests/bvt01 tests/bvt02 tests/bvt03 tests/bvt04 tests/bvt05 tests/bvt06 tests/bvt07 tests/bvt08 tests/bvt09 tests/bvt10 tests/bvt11 tests/bvt12 tests/bvt14 tests/bvt15 tests/bvt16 tests/bvt18 tests/bvt19 tests/bvt20 tests/bvt21 tests/bvt22 tests/bvt23 tests/bvt24 tests/bvt25 tests/bvt26 tests/bvt27") : "" )} description " This option specifies the set of tests for the uSTL library." }
--- a/packages/language/cxx/ustl/current/src/fstream.cpp +++ b/packages/language/cxx/ustl/current/src/fstream.cpp @@ -96,7 +96,11 @@ void fstream::detach (void) 0, // nocreate O_NOCTTY // noctty }; - int flags = (m - 1) & O_ACCMODE; // in and out + int flags; + if (O_RDONLY == in-1 && O_WRONLY == out-1 && O_RDWR == (in|out)-1) + flags = (m - 1) & O_ACCMODE; + else + flags = ((m&(in|out))==(in|out)) ? O_RDWR : ((m&out) ? O_WRONLY : O_RDONLY); for (uoff_t i = 0; i < VectorSize(s_OMFlags); ++ i) flags |= s_OMFlags[i] & (!(m & (1 << i)) - 1); if (m & nocreate)
--- a/packages/language/cxx/ustl/current/tests/bvt05.cpp +++ b/packages/language/cxx/ustl/current/tests/bvt05.cpp @@ -158,32 +158,32 @@ static void TestAlgorithms (void) PrintVector (v); v.assign (first, last); - cout << "fill 64083 uint8_t(0x41) "; - TestBigFill<uint8_t> (64083, 0x41); - cout << "fill 64083 uint16_t(0x4142) "; - TestBigFill<uint16_t> (64083, 0x4142); - cout << "fill 64083 uint32_t(0x41424344) "; - TestBigFill<uint32_t> (64083, 0x41424344); - cout << "fill 64083 float(0.4242) "; - TestBigFill<float> (64083, 0x4242f); + cout << "fill 3207 uint8_t(0x41) "; + TestBigFill<uint8_t> (3207, 0x41); + cout << "fill 3207 uint16_t(0x4142) "; + TestBigFill<uint16_t> (3207, 0x4142); + cout << "fill 3207 uint32_t(0x41424344) "; + TestBigFill<uint32_t> (3207, 0x41424344); + cout << "fill 3207 float(0.4242) "; + TestBigFill<float> (3207, 0x4242f); #if HAVE_INT64_T - cout << "fill 64083 uint64_t(0x4142434445464748) "; - TestBigFill<uint64_t> (64083, UINT64_C(0x4142434445464748)); + cout << "fill 3207 uint64_t(0x4142434445464748) "; + TestBigFill<uint64_t> (3207, UINT64_C(0x4142434445464748)); #else cout << "No 64bit types available on this platform\n"; #endif - cout << "copy 64083 uint8_t(0x41) "; - TestBigCopy<uint8_t> (64083, 0x41); - cout << "copy 64083 uint16_t(0x4142) "; - TestBigCopy<uint16_t> (64083, 0x4142); - cout << "copy 64083 uint32_t(0x41424344) "; - TestBigCopy<uint32_t> (64083, 0x41424344); - cout << "copy 64083 float(0.4242) "; - TestBigCopy<float> (64083, 0.4242f); + cout << "copy 3207 uint8_t(0x41) "; + TestBigCopy<uint8_t> (3207, 0x41); + cout << "copy 3207 uint16_t(0x4142) "; + TestBigCopy<uint16_t> (3207, 0x4142); + cout << "copy 3207 uint32_t(0x41424344) "; + TestBigCopy<uint32_t> (3207, 0x41424344); + cout << "copy 3207 float(0.4242) "; + TestBigCopy<float> (3207, 0.4242f); #if HAVE_INT64_T - cout << "copy 64083 uint64_t(0x4142434445464748) "; - TestBigCopy<uint64_t> (64083, UINT64_C(0x4142434445464748)); + cout << "copy 3207 uint64_t(0x4142434445464748) "; + TestBigCopy<uint64_t> (3207, UINT64_C(0x4142434445464748)); #else cout << "No 64bit types available on this platform\n"; #endif
--- a/packages/language/cxx/ustl/current/tests/bvt16.cpp +++ b/packages/language/cxx/ustl/current/tests/bvt16.cpp @@ -22,7 +22,7 @@ void TestUTF8 (void) { cout << "Generating Unicode characters "; vector<wchar_t> srcChars; - srcChars.resize (0xFFFF); + srcChars.resize (0xFFF); iota (srcChars.begin(), srcChars.end(), 0); cout.format ("%zu - %zu\n", size_t(srcChars[0]), size_t(srcChars.back()));
--- a/packages/language/cxx/ustl/current/tests/bvt25.cpp +++ b/packages/language/cxx/ustl/current/tests/bvt25.cpp @@ -5,6 +5,16 @@ #include "stdtest.h" +#ifdef CYGIMP_USTL_TESTS_BVT25_ROMFS +# include <cyg/fileio/fileio.h> +# if (CYG_BYTEORDER == CYG_LSBFIRST) +# include <cyg/ustl/bvt25fs_le.h> +# else +# include <cyg/ustl/bvt25fs_be.h> +# endif +MTAB_ENTRY(romfs_mte1, "/", "romfs", "", (CYG_ADDRWORD) &filedata[0]); +#endif + void TestFStream (void) { fstream fs ("bvt/bvt25.std", ios::in | ios::nocreate);
