A counter-example for integration by parts when there are "small" singularities I am looking for a "counter-example" to integration by parts of the following type:
$\Omega \subseteq \mathbb R^n$ is an open, bounded, connected domain with smooth boundary. $u,v:\bar \Omega \to \mathbb R$ are real-valued functions, where $u$ is smooth and compactly supported in $\Omega$, and $v$ is smooth on an open subset of $\bar \Omega$ whose complement is a closed subset of measure zero. I want $\int_{\Omega}(\partial_iu)v \neq -\int_{\Omega}u(\partial_iv)$, i.e. to demonstrate failure of integration by parts.
Edit:
Does the answer change if we assume in addition that $v$ is continuous everywhere on $\bar \Omega$?. BigbearZzz gave here an example with a non-continuous $v$.

If $v$ was smooth on all $\bar \Omega$, then integration by parts would work. The point is that I am limiting the singular set to be closed and of measure zero. I guess integration by parts still cannot be saved, but I don't have a concrete example. 
 A: I am a bit confused by the question, please tell me if I misread anything.
Consider the domain $\Omega=B_1\subset\Bbb R^2$, i.e. the unit ball. Define $v$ to be
$$
v(x)=\begin{cases}1 &; x<0 \\
0 &; x\ge 0.
\end{cases}
$$
We can see that $v$ is smooth on $\overline\Omega\backslash l$, where $l=\{(x,y)\in\Bbb R^2 : x=0\}$ which is a closed set of measure zero.
Next, we take $\varphi\in C^\infty_c(\Omega)$. Since $\nabla v(x)=0$ a.e., we have
$$
\int_\Omega \varphi \partial_i v = 0.
$$
On the other hand, we have 
$$\begin{align}
\int_\Omega(\partial_1\varphi)v = \int_{-1}^1 \varphi(0,y)\, dy 
\end{align}$$
since the distributional derivative of $v$ is the Hausdorff measure on $l$.
A: For a continuous counterexample, let's consider the case $\Bbb R^n=\Bbb R$ and $\Omega = (0,1)$. Let $v$ be the Cantor function

It has the property that $v'(x)=0$ a.e., thus for any function $\varphi\in C^\infty_c(0,1)$ we have
$$
\int_0^1 \varphi v' = 0.
$$
On the other hand, we have 
$$\begin{align}
\int_0^1 \varphi'v = -c_0\int_{0}^1 \varphi(t)\, d\nu(t) 
\end{align}$$
where $\nu=\mathcal H^\gamma\lvert_C$, the Hausdorff measure of dimension $\gamma= \ln 2 /\ln 3$ restricted to the Cantor set $C$ (which is a compact set). Here $c_0$ is a normalizing constant that I don't remember.
