diff options
-rw-r--r-- | ceph.spec.in | 1 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | src/test/Makefile.am | 2 | ||||
-rwxr-xr-x | src/test/pybind/test_ceph_argparse.py | 43 |
4 files changed, 47 insertions, 0 deletions
diff --git a/ceph.spec.in b/ceph.spec.in index 851ee7acfd5..a60d87ad814 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -37,6 +37,7 @@ BuildRequires: perl BuildRequires: gdbm BuildRequires: pkgconfig BuildRequires: python +BuildRequires: python-nose BuildRequires: libaio-devel BuildRequires: libcurl-devel BuildRequires: libxml2-devel diff --git a/debian/control b/debian/control index 44ee725efd4..1aec592c9f8 100644 --- a/debian/control +++ b/debian/control @@ -34,6 +34,7 @@ Build-Depends: autoconf, libxml2-dev, pkg-config, python (>= 2.6.6-3~), + python-nose, uuid-dev, yasm Standards-Version: 3.9.3 diff --git a/src/test/Makefile.am b/src/test/Makefile.am index 6c127615b42..5b709d248a8 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -546,6 +546,8 @@ unittest_texttable_LDADD = $(LIBCOMMON) $(UNITTEST_LDADD) unittest_texttable_CXXFLAGS = $(UNITTEST_CXXFLAGS) check_PROGRAMS += unittest_texttable +check_SCRIPTS += test/pybind/test_ceph_argparse.py + if WITH_RADOSGW ceph_test_cors_SOURCES = test/test_cors.cc ceph_test_cors_LDADD = \ diff --git a/src/test/pybind/test_ceph_argparse.py b/src/test/pybind/test_ceph_argparse.py new file mode 100755 index 00000000000..4e091da3d9f --- /dev/null +++ b/src/test/pybind/test_ceph_argparse.py @@ -0,0 +1,43 @@ +#!/usr/bin/nosetests --nocapture +# -*- mode:python; tab-width:4; indent-tabs-mode:t -*- +# vim: ts=4 sw=4 smarttab expandtab +# +# Ceph - scalable distributed file system +# +# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> +# +# Author: Loic Dachary <loic@dachary.org> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# + +from nose.tools import eq_ as eq +from nose.tools import * + +from ceph_argparse import validate_command, parse_json_funcsigs + +import os +import re +import json + +def get_command_descriptions(what): + buffer = os.popen("./get_command_descriptions " + "--" + what + + " 2>&1 | grep cmd000").read() + return re.sub(r'^.*?(\{.*\})', '\g<1>', buffer) + +def test_parse_json_funcsigs(): + commands = get_command_descriptions("all") + cmd_json = parse_json_funcsigs(commands, 'cli') + + # syntax error https://github.com/ceph/ceph/pull/585 + commands = get_command_descriptions("pull585") + assert_raises(TypeError, parse_json_funcsigs, commands, 'cli') + +# Local Variables: +# compile-command: "cd ../.. ; make -j4 && +# PYTHONPATH=pybind nosetests --stop \ +# test/pybind/test_ceph_argparse.py # test_ceph_argparse.py:TestOSD.test_rm" +# End: |