Skip to content

Commit

Permalink
Test program only requires Cabal >= 1.6 now
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobstanley committed Oct 24, 2010
1 parent 13a25bc commit c0e199f
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
*.swp
/cbits/*.exe
/dist/
/test/dist
2 changes: 1 addition & 1 deletion cbits/network-unix.c
Expand Up @@ -25,7 +25,7 @@ void maccopy(unsigned char *dst, struct sockaddr *addr)
#else
/* TODO check that sdl_alen is equal to 6 (MAC_SIZE) */
struct sockaddr_dl *sdl = (struct sockaddr_dl *)addr;
memcpy(dst, sdl->sdl_data + sdl-> sdl_nlen, MAC_SIZE);
memcpy(dst, sdl->sdl_data + sdl->sdl_nlen, MAC_SIZE);
#endif
}

Expand Down
56 changes: 20 additions & 36 deletions network-info.cabal
@@ -1,37 +1,32 @@
Name: network-info
version: 0.1.0.1
synopsis: Access the local computer's basic network configuration
description: This library provides simple read-only access to the local computer's
networking configuration. It is currently capable of getting a list of
all the network interfaces and their respective IPv4, IPv6 and MAC
addresses.
.
The executable 'test-network-info' will only be built if the flag 'test'
has been set.
homepage: http://github.com/jystic/network-info
license: BSD3
license-file: LICENSE
author: Jacob Stanley
maintainer: jacob@stanley.io
category: Network
build-type: Simple
cabal-version: >=1.8.0.4
name: network-info
version: 0.1.0.1
synopsis: Access the local computer's basic network configuration
description: This library provides simple read-only access to the local computer's
networking configuration. It is currently capable of getting a list of
all the network interfaces and their respective IPv4, IPv6 and MAC
addresses.
homepage: http://github.com/jystic/network-info
license: BSD3
license-file: LICENSE
author: Jacob Stanley
maintainer: jacob@stanley.io
category: Network
build-type: Simple
cabal-version: >= 1.6

extra-source-files:
cbits/common.h,
cbits/network.h,
README.mkd,
run-tests.sh,
run-tests.bat
test/src/Main.hs,
test/network-info-test.cabal,
test/run-tests.bat,
test/run-tests.sh,
README.mkd

source-repository head
type: git
location: git://github.com/jystic/network-info.git

Flag test
description: Build test program
default: False

Library
hs-source-dirs: src
include-dirs: cbits
Expand All @@ -50,14 +45,3 @@ Library
extra-libraries: iphlpapi
else
buildable: False

Executable test-network-info
hs-source-dirs: test
main-is: Main.hs

if flag(test)
build-depends:
base == 4.*,
network-info
else
buildable: False
2 changes: 0 additions & 2 deletions run-tests.bat

This file was deleted.

2 changes: 0 additions & 2 deletions run-tests.sh

This file was deleted.

24 changes: 24 additions & 0 deletions test/network-info-test.cabal
@@ -0,0 +1,24 @@
name: network-info-test
version: 0.1
build-type: Simple
cabal-version: >= 1.6

Executable network-info-test
hs-source-dirs: ../src src
include-dirs: ../cbits
cc-options: -Wall -Werror

main-is: Main.hs
other-modules: Network.Info

build-depends:
base == 4.*

if os(linux) || os(darwin)
c-sources: ../cbits/network-unix.c
else
if os(windows)
c-sources: ../cbits/network-windows.c
extra-libraries: iphlpapi
else
buildable: False
2 changes: 2 additions & 0 deletions test/run-tests.bat
@@ -0,0 +1,2 @@
@echo off
cabal configure && cabal build && .\dist\build\test-network-info\test-network-info.exe
6 changes: 6 additions & 0 deletions test/run-tests.sh
@@ -0,0 +1,6 @@
#!/bin/bash

TESTDIR="$(dirname -- "${0}")"
cd $TESTDIR

cabal configure && cabal build && ./dist/build/network-info-test/network-info-test
File renamed without changes.

0 comments on commit c0e199f

Please sign in to comment.