1*11be35a1SLionel Sambuc /* 2*11be35a1SLionel Sambuc * Automated Testing Framework (atf) 3*11be35a1SLionel Sambuc * 4*11be35a1SLionel Sambuc * Copyright (c) 2009 The NetBSD Foundation, Inc. 5*11be35a1SLionel Sambuc * All rights reserved. 6*11be35a1SLionel Sambuc * 7*11be35a1SLionel Sambuc * Redistribution and use in source and binary forms, with or without 8*11be35a1SLionel Sambuc * modification, are permitted provided that the following conditions 9*11be35a1SLionel Sambuc * are met: 10*11be35a1SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 11*11be35a1SLionel Sambuc * notice, this list of conditions and the following disclaimer. 12*11be35a1SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 13*11be35a1SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 14*11be35a1SLionel Sambuc * documentation and/or other materials provided with the distribution. 15*11be35a1SLionel Sambuc * 16*11be35a1SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND 17*11be35a1SLionel Sambuc * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 18*11be35a1SLionel Sambuc * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19*11be35a1SLionel Sambuc * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20*11be35a1SLionel Sambuc * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21*11be35a1SLionel Sambuc * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22*11be35a1SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23*11be35a1SLionel Sambuc * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24*11be35a1SLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25*11be35a1SLionel Sambuc * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26*11be35a1SLionel Sambuc * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27*11be35a1SLionel Sambuc * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28*11be35a1SLionel Sambuc */ 29*11be35a1SLionel Sambuc 30*11be35a1SLionel Sambuc #if defined(TESTS_ATF_ATF_C_H_BUILD_H) 31*11be35a1SLionel Sambuc # error "Cannot include h_build.h more than once." 32*11be35a1SLionel Sambuc #else 33*11be35a1SLionel Sambuc # define TESTS_ATF_ATF_C_H_BUILD_H 34*11be35a1SLionel Sambuc #endif 35*11be35a1SLionel Sambuc 36*11be35a1SLionel Sambuc /* --------------------------------------------------------------------- 37*11be35a1SLionel Sambuc * Test case data. 38*11be35a1SLionel Sambuc * --------------------------------------------------------------------- */ 39*11be35a1SLionel Sambuc 40*11be35a1SLionel Sambuc static struct c_o_test { 41*11be35a1SLionel Sambuc const char *msg; 42*11be35a1SLionel Sambuc const char *cc; 43*11be35a1SLionel Sambuc const char *cflags; 44*11be35a1SLionel Sambuc const char *cppflags; 45*11be35a1SLionel Sambuc const char *sfile; 46*11be35a1SLionel Sambuc const char *ofile; 47*11be35a1SLionel Sambuc bool hasoptargs; 48*11be35a1SLionel Sambuc const char *const optargs[16]; 49*11be35a1SLionel Sambuc const char *const expargv[16]; 50*11be35a1SLionel Sambuc } c_o_tests[] = { 51*11be35a1SLionel Sambuc { 52*11be35a1SLionel Sambuc "No flags", 53*11be35a1SLionel Sambuc "cc", 54*11be35a1SLionel Sambuc "", 55*11be35a1SLionel Sambuc "", 56*11be35a1SLionel Sambuc "test.c", 57*11be35a1SLionel Sambuc "test.o", 58*11be35a1SLionel Sambuc false, 59*11be35a1SLionel Sambuc { 60*11be35a1SLionel Sambuc NULL 61*11be35a1SLionel Sambuc }, 62*11be35a1SLionel Sambuc { 63*11be35a1SLionel Sambuc "cc", "-o", "test.o", "-c", "test.c", NULL 64*11be35a1SLionel Sambuc }, 65*11be35a1SLionel Sambuc }, 66*11be35a1SLionel Sambuc 67*11be35a1SLionel Sambuc { 68*11be35a1SLionel Sambuc "Multi-word program name", 69*11be35a1SLionel Sambuc "cc -foo", 70*11be35a1SLionel Sambuc "", 71*11be35a1SLionel Sambuc "", 72*11be35a1SLionel Sambuc "test.c", 73*11be35a1SLionel Sambuc "test.o", 74*11be35a1SLionel Sambuc false, 75*11be35a1SLionel Sambuc { 76*11be35a1SLionel Sambuc NULL 77*11be35a1SLionel Sambuc }, 78*11be35a1SLionel Sambuc { 79*11be35a1SLionel Sambuc "cc", "-foo", "-o", "test.o", "-c", "test.c", NULL 80*11be35a1SLionel Sambuc }, 81*11be35a1SLionel Sambuc }, 82*11be35a1SLionel Sambuc 83*11be35a1SLionel Sambuc { 84*11be35a1SLionel Sambuc "Some cflags", 85*11be35a1SLionel Sambuc "cc", 86*11be35a1SLionel Sambuc "-f1 -f2 -f3 -f4-f5", 87*11be35a1SLionel Sambuc "", 88*11be35a1SLionel Sambuc "test.c", 89*11be35a1SLionel Sambuc "test.o", 90*11be35a1SLionel Sambuc false, 91*11be35a1SLionel Sambuc { 92*11be35a1SLionel Sambuc NULL 93*11be35a1SLionel Sambuc }, 94*11be35a1SLionel Sambuc { 95*11be35a1SLionel Sambuc "cc", "-f1", "-f2", "-f3", "-f4-f5", "-o", "test.o", 96*11be35a1SLionel Sambuc "-c", "test.c", NULL 97*11be35a1SLionel Sambuc }, 98*11be35a1SLionel Sambuc }, 99*11be35a1SLionel Sambuc 100*11be35a1SLionel Sambuc { 101*11be35a1SLionel Sambuc "Some cppflags", 102*11be35a1SLionel Sambuc "cc", 103*11be35a1SLionel Sambuc "", 104*11be35a1SLionel Sambuc "-f1 -f2 -f3 -f4-f5", 105*11be35a1SLionel Sambuc "test.c", 106*11be35a1SLionel Sambuc "test.o", 107*11be35a1SLionel Sambuc false, 108*11be35a1SLionel Sambuc { 109*11be35a1SLionel Sambuc NULL 110*11be35a1SLionel Sambuc }, 111*11be35a1SLionel Sambuc { 112*11be35a1SLionel Sambuc "cc", "-f1", "-f2", "-f3", "-f4-f5", "-o", "test.o", 113*11be35a1SLionel Sambuc "-c", "test.c", NULL 114*11be35a1SLionel Sambuc }, 115*11be35a1SLionel Sambuc }, 116*11be35a1SLionel Sambuc 117*11be35a1SLionel Sambuc { 118*11be35a1SLionel Sambuc "Some cflags and cppflags", 119*11be35a1SLionel Sambuc "cc", 120*11be35a1SLionel Sambuc "-f2", 121*11be35a1SLionel Sambuc "-f1", 122*11be35a1SLionel Sambuc "test.c", 123*11be35a1SLionel Sambuc "test.o", 124*11be35a1SLionel Sambuc false, 125*11be35a1SLionel Sambuc { 126*11be35a1SLionel Sambuc NULL 127*11be35a1SLionel Sambuc }, 128*11be35a1SLionel Sambuc { 129*11be35a1SLionel Sambuc "cc", "-f1", "-f2", "-o", "test.o", "-c", "test.c", NULL 130*11be35a1SLionel Sambuc }, 131*11be35a1SLionel Sambuc }, 132*11be35a1SLionel Sambuc 133*11be35a1SLionel Sambuc { 134*11be35a1SLionel Sambuc "Some optional arguments", 135*11be35a1SLionel Sambuc "cc", 136*11be35a1SLionel Sambuc "", 137*11be35a1SLionel Sambuc "", 138*11be35a1SLionel Sambuc "test.c", 139*11be35a1SLionel Sambuc "test.o", 140*11be35a1SLionel Sambuc true, 141*11be35a1SLionel Sambuc { 142*11be35a1SLionel Sambuc "-o1", "-o2", NULL 143*11be35a1SLionel Sambuc }, 144*11be35a1SLionel Sambuc { 145*11be35a1SLionel Sambuc "cc", "-o1", "-o2", "-o", "test.o", "-c", "test.c", NULL 146*11be35a1SLionel Sambuc }, 147*11be35a1SLionel Sambuc }, 148*11be35a1SLionel Sambuc 149*11be35a1SLionel Sambuc { 150*11be35a1SLionel Sambuc "Some cflags, cppflags and optional arguments", 151*11be35a1SLionel Sambuc "cc", 152*11be35a1SLionel Sambuc "-f2", 153*11be35a1SLionel Sambuc "-f1", 154*11be35a1SLionel Sambuc "test.c", 155*11be35a1SLionel Sambuc "test.o", 156*11be35a1SLionel Sambuc true, 157*11be35a1SLionel Sambuc { 158*11be35a1SLionel Sambuc "-o1", "-o2", NULL 159*11be35a1SLionel Sambuc }, 160*11be35a1SLionel Sambuc { 161*11be35a1SLionel Sambuc "cc", "-f1", "-f2", "-o1", "-o2", "-o", "test.o", 162*11be35a1SLionel Sambuc "-c", "test.c", NULL 163*11be35a1SLionel Sambuc }, 164*11be35a1SLionel Sambuc }, 165*11be35a1SLionel Sambuc 166*11be35a1SLionel Sambuc { 167*11be35a1SLionel Sambuc NULL, 168*11be35a1SLionel Sambuc NULL, 169*11be35a1SLionel Sambuc NULL, 170*11be35a1SLionel Sambuc NULL, 171*11be35a1SLionel Sambuc NULL, 172*11be35a1SLionel Sambuc NULL, 173*11be35a1SLionel Sambuc false, 174*11be35a1SLionel Sambuc { NULL }, 175*11be35a1SLionel Sambuc { NULL }, 176*11be35a1SLionel Sambuc }, 177*11be35a1SLionel Sambuc }; 178*11be35a1SLionel Sambuc 179*11be35a1SLionel Sambuc static struct cpp_test { 180*11be35a1SLionel Sambuc const char *msg; 181*11be35a1SLionel Sambuc const char *cpp; 182*11be35a1SLionel Sambuc const char *cppflags; 183*11be35a1SLionel Sambuc const char *sfile; 184*11be35a1SLionel Sambuc const char *ofile; 185*11be35a1SLionel Sambuc bool hasoptargs; 186*11be35a1SLionel Sambuc const char *const optargs[16]; 187*11be35a1SLionel Sambuc const char *const expargv[16]; 188*11be35a1SLionel Sambuc } cpp_tests[] = { 189*11be35a1SLionel Sambuc { 190*11be35a1SLionel Sambuc "No flags", 191*11be35a1SLionel Sambuc "cpp", 192*11be35a1SLionel Sambuc "", 193*11be35a1SLionel Sambuc "test.c", 194*11be35a1SLionel Sambuc "test.out", 195*11be35a1SLionel Sambuc false, 196*11be35a1SLionel Sambuc { 197*11be35a1SLionel Sambuc NULL 198*11be35a1SLionel Sambuc }, 199*11be35a1SLionel Sambuc { 200*11be35a1SLionel Sambuc "cpp", "-o", "test.out", "test.c", NULL 201*11be35a1SLionel Sambuc }, 202*11be35a1SLionel Sambuc }, 203*11be35a1SLionel Sambuc 204*11be35a1SLionel Sambuc { 205*11be35a1SLionel Sambuc "Multi-word program name", 206*11be35a1SLionel Sambuc "cpp -foo", 207*11be35a1SLionel Sambuc "", 208*11be35a1SLionel Sambuc "test.c", 209*11be35a1SLionel Sambuc "test.out", 210*11be35a1SLionel Sambuc false, 211*11be35a1SLionel Sambuc { 212*11be35a1SLionel Sambuc NULL 213*11be35a1SLionel Sambuc }, 214*11be35a1SLionel Sambuc { 215*11be35a1SLionel Sambuc "cpp", "-foo", "-o", "test.out", "test.c", NULL 216*11be35a1SLionel Sambuc }, 217*11be35a1SLionel Sambuc }, 218*11be35a1SLionel Sambuc 219*11be35a1SLionel Sambuc { 220*11be35a1SLionel Sambuc "Some cppflags", 221*11be35a1SLionel Sambuc "cpp", 222*11be35a1SLionel Sambuc "-f1 -f2 -f3 -f4-f5", 223*11be35a1SLionel Sambuc "test.c", 224*11be35a1SLionel Sambuc "test.out", 225*11be35a1SLionel Sambuc false, 226*11be35a1SLionel Sambuc { 227*11be35a1SLionel Sambuc NULL 228*11be35a1SLionel Sambuc }, 229*11be35a1SLionel Sambuc { 230*11be35a1SLionel Sambuc "cpp", "-f1", "-f2", "-f3", "-f4-f5", "-o", "test.out", 231*11be35a1SLionel Sambuc "test.c", NULL 232*11be35a1SLionel Sambuc }, 233*11be35a1SLionel Sambuc }, 234*11be35a1SLionel Sambuc 235*11be35a1SLionel Sambuc { 236*11be35a1SLionel Sambuc "Some optional arguments", 237*11be35a1SLionel Sambuc "cpp", 238*11be35a1SLionel Sambuc "", 239*11be35a1SLionel Sambuc "test.c", 240*11be35a1SLionel Sambuc "test.out", 241*11be35a1SLionel Sambuc true, 242*11be35a1SLionel Sambuc { 243*11be35a1SLionel Sambuc "-o1", "-o2", NULL 244*11be35a1SLionel Sambuc }, 245*11be35a1SLionel Sambuc { 246*11be35a1SLionel Sambuc "cpp", "-o1", "-o2", "-o", "test.out", "test.c", NULL 247*11be35a1SLionel Sambuc }, 248*11be35a1SLionel Sambuc }, 249*11be35a1SLionel Sambuc 250*11be35a1SLionel Sambuc { 251*11be35a1SLionel Sambuc "Some cppflags and optional arguments", 252*11be35a1SLionel Sambuc "cpp", 253*11be35a1SLionel Sambuc "-f1", 254*11be35a1SLionel Sambuc "test.c", 255*11be35a1SLionel Sambuc "test.out", 256*11be35a1SLionel Sambuc true, 257*11be35a1SLionel Sambuc { 258*11be35a1SLionel Sambuc "-o1", "-o2", NULL 259*11be35a1SLionel Sambuc }, 260*11be35a1SLionel Sambuc { 261*11be35a1SLionel Sambuc "cpp", "-f1", "-o1", "-o2", "-o", "test.out", "test.c", NULL 262*11be35a1SLionel Sambuc }, 263*11be35a1SLionel Sambuc }, 264*11be35a1SLionel Sambuc 265*11be35a1SLionel Sambuc { 266*11be35a1SLionel Sambuc NULL, 267*11be35a1SLionel Sambuc NULL, 268*11be35a1SLionel Sambuc NULL, 269*11be35a1SLionel Sambuc NULL, 270*11be35a1SLionel Sambuc NULL, 271*11be35a1SLionel Sambuc false, 272*11be35a1SLionel Sambuc { NULL }, 273*11be35a1SLionel Sambuc { NULL }, 274*11be35a1SLionel Sambuc }, 275*11be35a1SLionel Sambuc }; 276*11be35a1SLionel Sambuc 277*11be35a1SLionel Sambuc static struct cxx_o_test { 278*11be35a1SLionel Sambuc const char *msg; 279*11be35a1SLionel Sambuc const char *cxx; 280*11be35a1SLionel Sambuc const char *cxxflags; 281*11be35a1SLionel Sambuc const char *cppflags; 282*11be35a1SLionel Sambuc const char *sfile; 283*11be35a1SLionel Sambuc const char *ofile; 284*11be35a1SLionel Sambuc bool hasoptargs; 285*11be35a1SLionel Sambuc const char *const optargs[16]; 286*11be35a1SLionel Sambuc const char *const expargv[16]; 287*11be35a1SLionel Sambuc } cxx_o_tests[] = { 288*11be35a1SLionel Sambuc { 289*11be35a1SLionel Sambuc "No flags", 290*11be35a1SLionel Sambuc "c++", 291*11be35a1SLionel Sambuc "", 292*11be35a1SLionel Sambuc "", 293*11be35a1SLionel Sambuc "test.c", 294*11be35a1SLionel Sambuc "test.o", 295*11be35a1SLionel Sambuc false, 296*11be35a1SLionel Sambuc { 297*11be35a1SLionel Sambuc NULL 298*11be35a1SLionel Sambuc }, 299*11be35a1SLionel Sambuc { 300*11be35a1SLionel Sambuc "c++", "-o", "test.o", "-c", "test.c", NULL 301*11be35a1SLionel Sambuc }, 302*11be35a1SLionel Sambuc }, 303*11be35a1SLionel Sambuc 304*11be35a1SLionel Sambuc { 305*11be35a1SLionel Sambuc "Multi-word program name", 306*11be35a1SLionel Sambuc "c++ -foo", 307*11be35a1SLionel Sambuc "", 308*11be35a1SLionel Sambuc "", 309*11be35a1SLionel Sambuc "test.c", 310*11be35a1SLionel Sambuc "test.o", 311*11be35a1SLionel Sambuc false, 312*11be35a1SLionel Sambuc { 313*11be35a1SLionel Sambuc NULL 314*11be35a1SLionel Sambuc }, 315*11be35a1SLionel Sambuc { 316*11be35a1SLionel Sambuc "c++", "-foo", "-o", "test.o", "-c", "test.c", NULL 317*11be35a1SLionel Sambuc }, 318*11be35a1SLionel Sambuc }, 319*11be35a1SLionel Sambuc 320*11be35a1SLionel Sambuc { 321*11be35a1SLionel Sambuc "Some cxxflags", 322*11be35a1SLionel Sambuc "c++", 323*11be35a1SLionel Sambuc "-f1 -f2 -f3 -f4-f5", 324*11be35a1SLionel Sambuc "", 325*11be35a1SLionel Sambuc "test.c", 326*11be35a1SLionel Sambuc "test.o", 327*11be35a1SLionel Sambuc false, 328*11be35a1SLionel Sambuc { 329*11be35a1SLionel Sambuc NULL 330*11be35a1SLionel Sambuc }, 331*11be35a1SLionel Sambuc { 332*11be35a1SLionel Sambuc "c++", "-f1", "-f2", "-f3", "-f4-f5", "-o", "test.o", 333*11be35a1SLionel Sambuc "-c", "test.c", NULL 334*11be35a1SLionel Sambuc }, 335*11be35a1SLionel Sambuc }, 336*11be35a1SLionel Sambuc 337*11be35a1SLionel Sambuc { 338*11be35a1SLionel Sambuc "Some cppflags", 339*11be35a1SLionel Sambuc "c++", 340*11be35a1SLionel Sambuc "", 341*11be35a1SLionel Sambuc "-f1 -f2 -f3 -f4-f5", 342*11be35a1SLionel Sambuc "test.c", 343*11be35a1SLionel Sambuc "test.o", 344*11be35a1SLionel Sambuc false, 345*11be35a1SLionel Sambuc { 346*11be35a1SLionel Sambuc NULL 347*11be35a1SLionel Sambuc }, 348*11be35a1SLionel Sambuc { 349*11be35a1SLionel Sambuc "c++", "-f1", "-f2", "-f3", "-f4-f5", "-o", "test.o", 350*11be35a1SLionel Sambuc "-c", "test.c", NULL 351*11be35a1SLionel Sambuc }, 352*11be35a1SLionel Sambuc }, 353*11be35a1SLionel Sambuc 354*11be35a1SLionel Sambuc { 355*11be35a1SLionel Sambuc "Some cxxflags and cppflags", 356*11be35a1SLionel Sambuc "c++", 357*11be35a1SLionel Sambuc "-f2", 358*11be35a1SLionel Sambuc "-f1", 359*11be35a1SLionel Sambuc "test.c", 360*11be35a1SLionel Sambuc "test.o", 361*11be35a1SLionel Sambuc false, 362*11be35a1SLionel Sambuc { 363*11be35a1SLionel Sambuc NULL 364*11be35a1SLionel Sambuc }, 365*11be35a1SLionel Sambuc { 366*11be35a1SLionel Sambuc "c++", "-f1", "-f2", "-o", "test.o", "-c", "test.c", NULL 367*11be35a1SLionel Sambuc }, 368*11be35a1SLionel Sambuc }, 369*11be35a1SLionel Sambuc 370*11be35a1SLionel Sambuc { 371*11be35a1SLionel Sambuc "Some optional arguments", 372*11be35a1SLionel Sambuc "c++", 373*11be35a1SLionel Sambuc "", 374*11be35a1SLionel Sambuc "", 375*11be35a1SLionel Sambuc "test.c", 376*11be35a1SLionel Sambuc "test.o", 377*11be35a1SLionel Sambuc true, 378*11be35a1SLionel Sambuc { 379*11be35a1SLionel Sambuc "-o1", "-o2", NULL 380*11be35a1SLionel Sambuc }, 381*11be35a1SLionel Sambuc { 382*11be35a1SLionel Sambuc "c++", "-o1", "-o2", "-o", "test.o", "-c", "test.c", NULL 383*11be35a1SLionel Sambuc }, 384*11be35a1SLionel Sambuc }, 385*11be35a1SLionel Sambuc 386*11be35a1SLionel Sambuc { 387*11be35a1SLionel Sambuc "Some cxxflags, cppflags and optional arguments", 388*11be35a1SLionel Sambuc "c++", 389*11be35a1SLionel Sambuc "-f2", 390*11be35a1SLionel Sambuc "-f1", 391*11be35a1SLionel Sambuc "test.c", 392*11be35a1SLionel Sambuc "test.o", 393*11be35a1SLionel Sambuc true, 394*11be35a1SLionel Sambuc { 395*11be35a1SLionel Sambuc "-o1", "-o2", NULL 396*11be35a1SLionel Sambuc }, 397*11be35a1SLionel Sambuc { 398*11be35a1SLionel Sambuc "c++", "-f1", "-f2", "-o1", "-o2", "-o", "test.o", 399*11be35a1SLionel Sambuc "-c", "test.c", NULL 400*11be35a1SLionel Sambuc }, 401*11be35a1SLionel Sambuc }, 402*11be35a1SLionel Sambuc 403*11be35a1SLionel Sambuc { 404*11be35a1SLionel Sambuc NULL, 405*11be35a1SLionel Sambuc NULL, 406*11be35a1SLionel Sambuc NULL, 407*11be35a1SLionel Sambuc NULL, 408*11be35a1SLionel Sambuc NULL, 409*11be35a1SLionel Sambuc NULL, 410*11be35a1SLionel Sambuc false, 411*11be35a1SLionel Sambuc { NULL }, 412*11be35a1SLionel Sambuc { NULL }, 413*11be35a1SLionel Sambuc }, 414*11be35a1SLionel Sambuc }; 415