OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [27_io/] [basic_filebuf/] [imbue/] [char/] [13171-2.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-require-namedlocale "fr_FR" }
2
// { dg-require-namedlocale "en_US" }
3
// { dg-require-fork "" }
4
// { dg-require-mkfifo "" }
5
 
6
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
7
// Free Software Foundation, Inc.
8
//
9
// This file is part of the GNU ISO C++ Library.  This library is free
10
// software; you can redistribute it and/or modify it under the
11
// terms of the GNU General Public License as published by the
12
// Free Software Foundation; either version 3, or (at your option)
13
// any later version.
14
 
15
// This library is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
// GNU General Public License for more details.
19
 
20
// You should have received a copy of the GNU General Public License along
21
// with this library; see the file COPYING3.  If not see
22
// <http://www.gnu.org/licenses/>.
23
 
24
// 27.8.1.4 Overridden virtual functions
25
 
26
#include <fstream>
27
#include <locale>
28
#include <cstdlib>
29
 
30
#include <sys/types.h>
31
#include <sys/stat.h>
32
 
33
// No asserts, avoid leaking the semaphores if a VERIFY fails.
34
#undef _GLIBCXX_ASSERT
35
 
36
#include <testsuite_hooks.h>
37
 
38
// libstdc++/13171
39
bool test01()
40
{
41
  bool test __attribute__((unused)) = true;
42
  using namespace std;
43
  using namespace __gnu_test;
44
 
45
  locale loc_fr(locale("fr_FR"));
46
  locale loc_en(locale("en_US"));
47
 
48
  const char* name = "tmp_fifo_13171-2";
49
  unlink(name);
50
  mkfifo(name, S_IRWXU);
51
  semaphore s1, s2;
52
 
53
  int child = fork();
54
  if (child == 0)
55
    {
56
      filebuf fb;
57
      fb.open(name, ios_base::out);
58
      fb.sputc('S');
59
      fb.pubsync();
60
      s1.signal();
61
      s2.wait();
62
      fb.close();
63
      exit(0);
64
    }
65
 
66
  filebuf fb;
67
  fb.pubimbue(loc_fr);
68
  fb.open(name, ios_base::in);
69
  s1.wait();
70
  VERIFY( fb.is_open() );
71
  fb.pubimbue(loc_en);
72
  filebuf::int_type c = fb.sgetc();
73
  fb.close();
74
  VERIFY( c == 'S' );
75
  s2.signal();
76
 
77
  return test;
78
}
79
 
80
int main()
81
{
82
  return !test01();
83
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.