0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #include <string.h>
0035 #include <stdio.h>
0036 #include <stdlib.h>
0037 #include <memory.h>
0038 #include <math.h>
0039
0040 #include <atmi.h>
0041 #include <ubf.h>
0042 #include <ndebug.h>
0043 #include <test.fd.h>
0044 #include <ndrstandard.h>
0045 #include <nstopwatch.h>
0046 #include <fcntl.h>
0047 #include <unistd.h>
0048 #include <nstdutil.h>
0049 #include "test85.h"
0050 #include <exassert.h>
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 int main(int argc, char** argv)
0063 {
0064
0065 UBFH *p_ub = (UBFH *)tpalloc("UBF", NULL, 56000);
0066 long rsplen;
0067 int i;
0068 int ret=EXSUCCEED;
0069
0070 if (EXFAIL==CBchg(p_ub, T_STRING_FLD, 0, VALUE_EXPECTED, 0, BFLD_STRING))
0071 {
0072 NDRX_LOG(log_debug, "Failed to set T_STRING_FLD[0]: %s", Bstrerror(Berror));
0073 ret=EXFAIL;
0074 goto out;
0075 }
0076
0077
0078
0079
0080 if (EXSUCCEED==tpsprio(0, TPABSOLUTE))
0081 {
0082 NDRX_LOG(log_error, "TESTERROR: 0 prio ABS shall fail");
0083 ret=EXFAIL;
0084 goto out;
0085 }
0086 NDRX_ASSERT_VAL_OUT(tperrno==TPEINVAL, "INvalid error, expected TPEINVAL got %d", tperrno);
0087
0088 if (EXSUCCEED==tpsprio(101, TPABSOLUTE))
0089 {
0090 NDRX_LOG(log_error, "TESTERROR: 101 prio ABS shall fail");
0091 ret=EXFAIL;
0092 goto out;
0093 }
0094 NDRX_ASSERT_VAL_OUT(tperrno==TPEINVAL, "Invalid error, expected TPEINVAL got %d", tperrno);
0095
0096
0097 if (EXSUCCEED!=tpsprio(60, TPABSOLUTE))
0098 {
0099 NDRX_LOG(log_error, "TESTERROR: failed to set tpsprio()");
0100 ret=EXFAIL;
0101 goto out;
0102 }
0103
0104 if (EXFAIL == tpcall("TESTSV", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0))
0105 {
0106 NDRX_LOG(log_error, "TESTSV failed: %s", tpstrerror(tperrno));
0107 ret=EXFAIL;
0108 goto out;
0109 }
0110
0111 if (60!=(ret=tpgprio()))
0112 {
0113 NDRX_LOG(log_error, "TESTERROR: failed to verify tpgprio() got %d", ret);
0114 ret=EXFAIL;
0115 goto out;
0116 }
0117
0118 ret=EXSUCCEED;
0119
0120 if (EXFAIL == tpcall("TESTSV", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0))
0121 {
0122 NDRX_LOG(log_error, "TESTSV failed: %s", tpstrerror(tperrno));
0123 ret=EXFAIL;
0124 goto out;
0125 }
0126
0127 if (50!=(ret=tpgprio()))
0128 {
0129 NDRX_LOG(log_error, "TESTERROR: failed to verify tpgprio() got %d", ret);
0130 ret=EXFAIL;
0131 goto out;
0132 }
0133 ret=EXSUCCEED;
0134
0135
0136
0137 if (EXSUCCEED==tpsprio(101, 0))
0138 {
0139 NDRX_LOG(log_error, "TESTERROR: 101 prio rel shall fail");
0140 ret=EXFAIL;
0141 goto out;
0142 }
0143 NDRX_ASSERT_VAL_OUT(tperrno==TPEINVAL, "INvalid error, expected TPEINVAL got %d", tperrno);
0144
0145 if (EXSUCCEED==tpsprio(-101, 0))
0146 {
0147 NDRX_LOG(log_error, "TESTERROR: 101 prio rel shall fail");
0148 ret=EXFAIL;
0149 goto out;
0150 }
0151 NDRX_ASSERT_VAL_OUT(tperrno==TPEINVAL, "INvalid error, expected TPEINVAL got %d", tperrno);
0152
0153
0154 if (EXSUCCEED!=tpsprio(-10, 0))
0155 {
0156 NDRX_LOG(log_error, "TESTERROR: failed to set tpsprio()");
0157 ret=EXFAIL;
0158 goto out;
0159 }
0160
0161 if (EXFAIL == tpcall("TESTSV", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0))
0162 {
0163 NDRX_LOG(log_error, "TESTSV failed: %s", tpstrerror(tperrno));
0164 ret=EXFAIL;
0165 goto out;
0166 }
0167
0168 if (40!=(ret=tpgprio()))
0169 {
0170 NDRX_LOG(log_error, "TESTERROR: failed to verify tpgprio() got %d", ret);
0171 ret=EXFAIL;
0172 goto out;
0173 }
0174
0175 ret=EXSUCCEED;
0176
0177
0178 if (EXSUCCEED!=tpsprio(-99, 0))
0179 {
0180 NDRX_LOG(log_error, "TESTERROR: failed to set tpsprio()");
0181 ret=EXFAIL;
0182 goto out;
0183 }
0184
0185 if (EXFAIL == tpcall("TESTSV", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0))
0186 {
0187 NDRX_LOG(log_error, "TESTSV failed: %s", tpstrerror(tperrno));
0188 ret=EXFAIL;
0189 goto out;
0190 }
0191
0192 if (1!=(ret=tpgprio()))
0193 {
0194 NDRX_LOG(log_error, "TESTERROR: failed to verify tpgprio() got %d", ret);
0195 ret=EXFAIL;
0196 goto out;
0197 }
0198
0199 ret=EXSUCCEED;
0200
0201
0202
0203 if (EXSUCCEED!=tpsprio(99, 0))
0204 {
0205 NDRX_LOG(log_error, "TESTERROR: failed to set tpsprio()");
0206 ret=EXFAIL;
0207 goto out;
0208 }
0209
0210 if (EXFAIL == tpcall("TESTSV", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0))
0211 {
0212 NDRX_LOG(log_error, "TESTSV failed: %s", tpstrerror(tperrno));
0213 ret=EXFAIL;
0214 goto out;
0215 }
0216
0217 if (100!=(ret=tpgprio()))
0218 {
0219 NDRX_LOG(log_error, "TESTERROR: failed to verify tpgprio() got %d", ret);
0220 ret=EXFAIL;
0221 goto out;
0222 }
0223
0224 ret=EXSUCCEED;
0225
0226 if (EXFAIL == tpcall("TESTSV", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0))
0227 {
0228 NDRX_LOG(log_error, "TESTSV failed: %s", tpstrerror(tperrno));
0229 ret=EXFAIL;
0230 goto out;
0231 }
0232
0233 if (50!=(ret=tpgprio()))
0234 {
0235 NDRX_LOG(log_error, "TESTERROR: failed to verify tpgprio() got %d", ret);
0236 ret=EXFAIL;
0237 goto out;
0238 }
0239
0240 ret=EXSUCCEED;
0241
0242
0243 out:
0244 tpterm();
0245 fprintf(stderr, "Exit with %d\n", ret);
0246
0247 return ret;
0248 }
0249
0250