MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
my_fileutils-t.cc
1 /* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 // First include (the generated) my_config.h, to get correct platform defines.
17 #include "my_config.h"
18 #include <gtest/gtest.h>
19 #ifdef HAVE_UNISTD_H
20 #include <unistd.h>
21 #endif
22 
23 #include "my_global.h"
24 #include "my_sys.h"
25 #include "mysql/psi/mysql_file.h"
26 
27 #if !defined(__WIN__)
28 TEST(FileUtilsTest, TellPipe)
29 {
30  int pipefd[2];
31  EXPECT_EQ(0, pipe(pipefd));
32  my_off_t pos= mysql_file_tell(pipefd[1], MYF(0));
33  EXPECT_EQ(MY_FILEPOS_ERROR, pos);
34  EXPECT_EQ(ESPIPE, my_errno);
35  EXPECT_EQ(0, close(pipefd[0]));
36  EXPECT_EQ(0, close(pipefd[1]));
37 }
38 #endif