genericopenlibs/openenvcore/libc/test/testsysunistd/src/tsysunistd.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "tsysunistd.h"
       
    21 
       
    22 CTestSysunistd::~CTestSysunistd() 
       
    23 	{ 
       
    24 	}  
       
    25 
       
    26 CTestSysunistd::CTestSysunistd(const TDesC& aStepName)
       
    27 	{
       
    28 	// MANDATORY Call to base class method to set up the human readable name for logging.
       
    29 	SetTestStepName(aStepName);		
       
    30 	}
       
    31 
       
    32 TVerdict CTestSysunistd::doTestStepPreambleL()
       
    33 	{
       
    34 	__UHEAP_MARK;	
       
    35 	SetTestStepResult(EPass);
       
    36 	return TestStepResult();
       
    37 	}
       
    38 
       
    39 
       
    40 
       
    41 TVerdict CTestSysunistd::doTestStepPostambleL()
       
    42 	{
       
    43 	__UHEAP_MARKEND;	
       
    44 	return TestStepResult();
       
    45 	}
       
    46 
       
    47 
       
    48 TVerdict CTestSysunistd::doTestStepL()
       
    49 	{
       
    50 	int err;
       
    51 
       
    52    	if(TestStepName() == Kftruncate_file)
       
    53    		{
       
    54    		INFO_PRINTF1(_L("ftruncate_file():"));
       
    55    		err = ftruncate_file();
       
    56    		SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    57    		}
       
    58 	else if(TestStepName() == Kftruncate_dir)
       
    59    		{
       
    60    	   	INFO_PRINTF1(_L("ftruncate_dir():"));
       
    61    	   	err = ftruncate_dir();
       
    62    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    63    	   	}
       
    64    	else if(TestStepName() == Kftruncate_num)
       
    65    		{
       
    66    	   	INFO_PRINTF1(_L("ftruncate_num():"));
       
    67    	   	err = ftruncate_num();
       
    68    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    69    	   	}
       
    70    	   	
       
    71 	else if(TestStepName() == Kftruncate_siz)
       
    72    		{
       
    73    	   	INFO_PRINTF1(_L("ftruncate_siz():"));
       
    74    	   	err = ftruncate_siz();
       
    75    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    76    	   	}
       
    77    	   	
       
    78 	else if(TestStepName() == Kfchdir_dir)
       
    79    		{
       
    80    	   	INFO_PRINTF1(_L("fchdir_dir():"));
       
    81    	   	err = fchdir_dir();
       
    82    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    83    	   	}
       
    84    	   	
       
    85 	else if(TestStepName() == Kfchdir_file)
       
    86    		{
       
    87    	   	INFO_PRINTF1(_L("fchdir_file():"));
       
    88    	   	err = fchdir_file();
       
    89    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    90    	   	}
       
    91    	   	
       
    92 	else if(TestStepName() == Kfchdir_num)
       
    93    		{
       
    94    	   	INFO_PRINTF1(_L("fchdir_num():"));
       
    95    	   	err = fchdir_num();
       
    96    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
    97    	   	}
       
    98    	   	
       
    99 	else if(TestStepName() == Kfdatasync_file)
       
   100    		{
       
   101    	   	INFO_PRINTF1(_L("fdatasync_file():"));
       
   102    	   	err = fdatasync_file();
       
   103    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   104    	   	}
       
   105    	   	
       
   106 	else if(TestStepName() == Kgetpagesize)
       
   107    		{
       
   108    	   	INFO_PRINTF1(_L("getpagesize():"));
       
   109    	   	err = getpagesizeL();
       
   110    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   111    	   	}
       
   112    	   	
       
   113 	else if(TestStepName() == Kgetpriority)
       
   114    		{
       
   115    	   	INFO_PRINTF1(_L("getpriority():"));
       
   116    	   	err = getpriorityL();
       
   117    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   118    	   	}
       
   119    	   	
       
   120 	else if(TestStepName() == Kgetpriority_other)
       
   121    		{
       
   122    	   	INFO_PRINTF1(_L("getpriority_other():"));
       
   123    	   	err = getpriority_other();
       
   124    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   125    	   	}
       
   126    	   	
       
   127 	else if(TestStepName() == Ksetpriority_get)
       
   128    		{
       
   129    	   	INFO_PRINTF1(_L("setpriority_get():"));
       
   130    	   	err = setpriority_get();
       
   131    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   132    	   	}
       
   133    	   	
       
   134 	else if(TestStepName() == Ksetpriority_high)
       
   135    		{
       
   136    	   	INFO_PRINTF1(_L("setpriority_high():"));
       
   137    	   	err = setpriority_high();
       
   138    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   139    	   	}
       
   140    	   	
       
   141 	else if(TestStepName() == Ksetpriority_other_lower)
       
   142    		{
       
   143    	   	INFO_PRINTF1(_L("setpriority_other_lower():"));
       
   144    	   	err = setpriority_other_lower();
       
   145    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   146    	   	}
       
   147    	   	
       
   148 	else if(TestStepName() == Ksetpriority_other_higher)
       
   149    		{
       
   150    	   	INFO_PRINTF1(_L("setpriority_other_higher():"));
       
   151    	   	err = setpriority_other_higher();
       
   152    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   153    	   	}
       
   154    	   	
       
   155 	else if(TestStepName() == Ksetpriority_other)
       
   156    		{
       
   157    	   	INFO_PRINTF1(_L("setpriority_other():"));
       
   158    	   	err = setpriority_other();
       
   159    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   160    	   	}
       
   161    	   	
       
   162 	else if(TestStepName() == Knice_within_range)
       
   163    		{
       
   164    	   	INFO_PRINTF1(_L("nice_within_range():"));
       
   165    	   	err = nice_within_range();
       
   166    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   167    	   	}
       
   168    	   	
       
   169 	else if(TestStepName() == Knice_more_than_highest)
       
   170    		{
       
   171    	   	INFO_PRINTF1(_L("nice_more_than_highest():"));
       
   172    	   	err = nice_more_than_highest();
       
   173    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   174    	   	}
       
   175    	   	
       
   176    	else if(TestStepName() == Knice_less_than_lowest)
       
   177    		{
       
   178    	   	INFO_PRINTF1(_L("nice_less_than_lowest():"));
       
   179    	   	err = nice_less_than_lowest();
       
   180    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   181    	   	}
       
   182    	   	
       
   183 	else if(TestStepName() == Kpathconf_valid)
       
   184    		{
       
   185    	   	INFO_PRINTF1(_L("pathconf_valid():"));
       
   186    	   	err = pathconf_valid();
       
   187    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   188    	   	}
       
   189    	   	
       
   190 	else if(TestStepName() == Kpathconf_invalid)
       
   191    		{
       
   192    	   	INFO_PRINTF1(_L("pathconf_invalid():"));
       
   193    	   	err = pathconf_invalid();
       
   194    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   195    	   	}
       
   196    	   	
       
   197 	else if(TestStepName() == Kuname)
       
   198    		{
       
   199    	   	INFO_PRINTF1(_L("uname():"));
       
   200    	   	err = unameL();
       
   201    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   202    	   	}
       
   203    	   	
       
   204    	else if(TestStepName() == Kuname_null)
       
   205    		{
       
   206    	   	INFO_PRINTF1(_L("uname_null():"));
       
   207    	   	err = uname_null();
       
   208    	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   209    	   	}
       
   210    	
       
   211    	else if(TestStepName() == Kftruncate_negTest)
       
   212    	   		{
       
   213    	   	   	INFO_PRINTF1(_L("ftruncate_negTest():"));
       
   214    	   	   	err = ftruncate_negTest();
       
   215    	   	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   216    	   	   	}
       
   217    	
       
   218    	else if(TestStepName() == Ktruncate_negTest)
       
   219    	   	   		{
       
   220    	   	   	   	INFO_PRINTF1(_L("truncate_negTest():"));
       
   221    	   	   	   	err = truncate_negTest();
       
   222    	   	   	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   223    	   	   	   	}
       
   224 	else if(TestStepName() == Kfcntl_largefileTest)
       
   225    	   	   		{
       
   226    	   	   	   	INFO_PRINTF1(_L("fcntl_largefileTest():"));
       
   227    	   	   	   	err = fcntl_largefileTest();
       
   228    	   	   	   	SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
       
   229    	   	   	   	}     	
       
   230 	return TestStepResult(); 
       
   231 
       
   232 	}
       
   233 
       
   234