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 
0046 
0047 
0048 
0049 #if EX_SIZEOF_LONG==4
0050 #define TEST_ASYNC_LOOPS    20000
0051 #else
0052 #define TEST_ASYNC_LOOPS    200000
0053 #endif
0054 
0055 
0056 
0057 
0058 
0059 
0060 
0061 
0062 
0063 
0064 
0065 
0066 
0067 
0068 
0069 
0070 exprivate int tpacall_tpnoreply_forward_test(void)
0071 {
0072     int ret = EXSUCCEED;
0073     int j;
0074     long rsplen;
0075     UBFH *p_ub = (UBFH *)tpalloc("UBF", NULL, 8192);
0076     
0077     for (j=0; j<TEST_ASYNC_LOOPS; j++)
0078     {
0079         Binit(p_ub, Bsizeof(p_ub));
0080         Badd(p_ub, T_STRING_FLD, "tpacall_tpnoreply_forward_test", 0);
0081 
0082         if (EXFAIL==tpacall("TEST2_1ST_AL", (char *)p_ub, 0, TPNOREPLY))
0083         {
0084             NDRX_LOG(log_error, "TESTERROR: failed to call TEST2_1ST_AL with TPNOREPLY: %s", 
0085                     tpstrerror(tperrno));
0086             
0087             EXFAIL_OUT(ret);
0088         }
0089     }
0090 
0091     
0092     if (EXFAIL == tpcall("TEST2_1ST_AL", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,TPNOTIME))
0093     {
0094         NDRX_LOG(log_error, "TEST2_1ST_AL failed: %s",
0095                tpstrerror(tperrno));
0096         ret=EXFAIL;
0097         goto out;
0098     }
0099 out:
0100     if (NULL!=p_ub)
0101     {
0102         tpfree((char *)p_ub);
0103     }
0104     return ret;
0105 }
0106 
0107 
0108 
0109 
0110 
0111 
0112 exprivate int tpacall_tpnoreply_forward_nodestsrv(void)
0113 {
0114     int ret = EXSUCCEED;
0115     int j;
0116     UBFH *p_ub = (UBFH *)tpalloc("UBF", NULL, 8192);
0117     long rsplen;
0118     
0119     for (j=0; j<TEST_ASYNC_LOOPS; j++)
0120     {
0121         Binit(p_ub, Bsizeof(p_ub));
0122         Badd(p_ub, T_STRING_FLD, "tpacall_tpnoreply_forward_nodestsrv", 0);
0123         Badd(p_ub, T_STRING_10_FLD, "failure set", 0);
0124 
0125         if (EXFAIL==tpacall("TEST2_1ST_AL", (char *)p_ub, 0, TPNOREPLY))
0126         {
0127             NDRX_LOG(log_error, "TESTERROR: failed to call TEST2_1ST_AL with TPNOREPLY: %s", 
0128                     tpstrerror(tperrno));
0129             
0130             EXFAIL_OUT(ret);
0131         }
0132     }
0133 
0134     
0135     Bdel(p_ub, T_STRING_10_FLD, 0);
0136     if (EXFAIL == tpcall("TEST2_1ST_AL", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,TPNOTIME))
0137     {
0138         NDRX_LOG(log_error, "TEST2_1ST_AL failed: %s",
0139                tpstrerror(tperrno));
0140         ret=EXFAIL;
0141         goto out;
0142     }
0143 
0144 out:
0145     if (NULL!=p_ub)
0146     {
0147         tpfree((char *)p_ub);
0148     }
0149     return ret;
0150 }
0151 
0152 
0153 
0154 
0155 int main(int argc, char** argv) {
0156 
0157     UBFH *p_ub = (UBFH *)tpalloc("UBF", NULL, 8192);
0158     long rsplen;
0159     int i,j;
0160     long cnt = 0;
0161     int ret=EXSUCCEED;
0162     double d, d2;
0163     double dv = 55.66;
0164     double dv2 = 11.66;
0165     
0166     for (j=0; j<100000; j++)
0167     {
0168         Binit(p_ub, Bsizeof(p_ub));
0169 
0170         Badd(p_ub, T_STRING_FLD, "THIS IS TEST FIELD 1", 0);
0171         Badd(p_ub, T_STRING_FLD, "THIS IS TEST FIELD 2", 0);
0172         Badd(p_ub, T_STRING_FLD, "THIS IS TEST FIELD 3", 0);
0173 
0174         for (i=0; i<100; i++)
0175         {
0176             cnt++;
0177             dv+=1;
0178             dv2+=1;
0179 
0180             if (EXFAIL == tpcall("TEST2_1ST_AL", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0))
0181             {
0182                 NDRX_LOG(log_error, "TEST2_1ST_AL failed: %s",
0183                         tpstrerror(tperrno));
0184                 ret=EXFAIL;
0185                 goto out;
0186             }
0187 
0188             
0189             if (EXFAIL==Bget(p_ub, T_DOUBLE_FLD, i, (char *)&d, 0))
0190             {
0191                 NDRX_LOG(log_debug, "Failed to get T_DOUBLE_FLD[%d]", i);
0192                 ret=EXFAIL;
0193                 goto out;
0194             }
0195 
0196             if (EXFAIL==Bget(p_ub, T_DOUBLE_2_FLD, i, (char *)&d2, 0))
0197             {
0198                 NDRX_LOG(log_debug, "Failed to get T_DOUBLE_2_FLD[%d]", i);
0199                 ret=EXFAIL;
0200                 goto out;
0201             }
0202 
0203             if (fabs(dv-d) > 0.00001)
0204             {
0205                 NDRX_LOG(log_debug, "T_DOUBLE_FLD: %lf!=%lf =>  FAIL", dv, d);
0206                 ret=EXFAIL;
0207                 goto out;
0208             }
0209 
0210             if (fabs(dv2 - d2) > 0.00001)
0211             {
0212                 NDRX_LOG(log_debug, "T_DOUBLE_2_FLD: %lf!=%lf =>  FAIL", dv, d);
0213                 ret=EXFAIL;
0214                 goto out;
0215             }
0216 
0217             
0218             Bfprint(p_ub, stderr);
0219         }
0220 
0221         NDRX_LOG(log_debug, "CURRENT CNT: %ld", cnt);
0222         if (argc<=1)
0223         {
0224             break;
0225         }
0226     }
0227     
0228     
0229     if (EXSUCCEED!=tpacall_tpnoreply_forward_test())
0230     {
0231         EXFAIL_OUT(ret);
0232     }
0233     
0234     if (EXSUCCEED!=tpacall_tpnoreply_forward_nodestsrv())
0235     {
0236         EXFAIL_OUT(ret);
0237     }
0238 
0239 out:
0240     if (NULL!=p_ub)
0241     {
0242         tpfree((char *)p_ub);
0243     }
0244     return ret;
0245 }
0246 
0247