Import a test for "wpa_supplicant"

This commit is contained in:
Pierre Pronchery 2017-09-15 00:14:20 +02:00
parent fd73137136
commit d945f7495c
3 changed files with 61 additions and 2 deletions

View File

@ -1,4 +1,4 @@
targets=applets,applets2,tests.log,user
targets=applets,applets2,tests.log,user,wpa_supplicant
cppflags_force=-I ../include
cflags_force=`pkg-config --cflags libDesktop`
cflags=-W -Wall -g -O2 -pedantic -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector-all
@ -18,7 +18,7 @@ sources=applets2.c
[tests.log]
type=script
script=./tests.sh
depends=$(OBJDIR)applets$(EXEEXT),$(OBJDIR)applets2$(EXEEXT),tests.sh,$(OBJDIR)user$(EXEEXT)
depends=$(OBJDIR)applets$(EXEEXT),$(OBJDIR)applets2$(EXEEXT),tests.sh,$(OBJDIR)user$(EXEEXT),$(OBJDIR)wpa_supplicant$(EXEEXT)
[user]
type=binary
@ -26,3 +26,11 @@ sources=user.c
[user.c]
depends=../src/applets/user.c
[wpa_supplicant]
type=binary
ldflags=-L../src -L$(OBJDIR). -Wl,-rpath,$(PREFIX)/lib -lPanel
sources=wpa_supplicant.c
[wpa_supplicant.c]
depends=../src/applets/wpa_supplicant.c

View File

@ -100,6 +100,7 @@ $DATE > "$target"
FAILED=
echo "Performing tests:" 1>&2
_test "user"
_test "wpa_supplicant"
echo "Expected failures:" 1>&2
_fail "applets"
[ -z "$DISPLAY" ] || _fail "applets2"

50
tests/wpa_supplicant.c Normal file
View File

@ -0,0 +1,50 @@
/* $Id$ */
/* Copyright (c) 2017 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Panel */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "../src/applets/wpa_supplicant.c"
#define PROGNAME "wpa_supplicant"
/* flags */
static int _flags(char const * flags, uint32_t expected)
{
uint32_t u32 = 0;
if(_read_scan_results_flag(NULL, flags, &u32) == NULL
|| u32 != expected)
{
printf("%s: %s: Obtained: %#x (expected: %#x)\n", PROGNAME,
flags, u32, expected);
return 2;
}
return 0;
}
/* main */
int main(void)
{
int ret = 0;
ret |= _flags("WPA-PSK-CCMP", (WSRF_WPA | WSRF_PSK | WSRF_CCMP));
ret |= _flags("WPA2-PSK-TKIP", (WSRF_WPA2 | WSRF_PSK | WSRF_TKIP));
ret |= _flags("WPA2-PSK-TKIP+CCMP", (WSRF_WPA2 | WSRF_PSK | WSRF_TKIP
| WSRF_CCMP));
return ret;
}