static void test_get_set(void **state) { #ifndef HAVE_OPENPAM const char *svc; #endif enum pamtest_err perr; struct pam_testcase tests[] = { pam_test(PAMTEST_OPEN_SESSION, PAM_SUCCESS), pam_test(PAMTEST_GETENVLIST, PAM_SUCCESS), }; (void) state; /* unused */ #ifndef HAVE_OPENPAM test_setenv("PAM_SERVICE"); #endif test_setenv("PAM_USER"); test_setenv("PAM_USER_PROMPT"); test_setenv("PAM_TTY"); test_setenv("PAM_RUSER"); test_setenv("PAM_RHOST"); test_setenv("PAM_AUTHTOK"); test_setenv("PAM_OLDAUTHTOK"); #ifdef PAM_XDISPLAY test_setenv("PAM_XDISPLAY"); #endif #ifdef PAM_AUTHTOK_TYPE test_setenv("PAM_AUTHTOK_TYPE"); #endif perr = run_pamtest("pwrap_get_set", "trinity", NULL, tests); assert_int_equal(perr, PAMTEST_ERR_OK); /* PAM_SERVICE is a special case, Linux's libpam lowercases it. * OpenPAM only allows PAM_SERVICE to be set by pam_start() */ #ifndef HAVE_OPENPAM svc = string_in_list(tests[1].case_out.envlist, "PAM_SERVICE"); assert_non_null(svc); assert_string_equal(svc, "test_pam_service"); #endif test_getenv(tests[1].case_out.envlist, "PAM_USER"); test_getenv(tests[1].case_out.envlist, "PAM_USER_PROMPT"); test_getenv(tests[1].case_out.envlist, "PAM_TTY"); test_getenv(tests[1].case_out.envlist, "PAM_RUSER"); test_getenv(tests[1].case_out.envlist, "PAM_RHOST"); test_getenv(tests[1].case_out.envlist, "PAM_AUTHTOK"); test_getenv(tests[1].case_out.envlist, "PAM_OLDAUTHTOK"); #ifdef PAM_XDISPLAY test_getenv(tests[1].case_out.envlist, "PAM_XDISPLAY"); #endif #ifdef PAM_AUTHTOK_TYPE test_getenv(tests[1].case_out.envlist, "PAM_AUTHTOK_TYPE"); #endif pamtest_free_env(tests[1].case_out.envlist); }
rtems_task Init( rtems_task_argument ignored ) { puts( "\n\n*** U-Boot Get Environment Variable Test ***" ); #if defined(HAS_UBOOT) test_getenv( "ipaddr" ); test_getenv( "baudrate" ); test_getenv( "bootcmd" ); test_getenv( "badname" ); #else puts( "This BSP does not have U-Boot." ); #endif puts( "*** END of U-Boot Get Environment Variable Test ***" ); exit( 0 ); }